(cmd: LaunchCommand)
| 185 | } |
| 186 | |
| 187 | export async function launchDetached(cmd: LaunchCommand): Promise<void> { |
| 188 | return new Promise<void>((resolve, reject) => { |
| 189 | let settled = false; |
| 190 | const child = spawn(cmd.command, cmd.args, { |
| 191 | detached: true, |
| 192 | stdio: 'ignore', |
| 193 | shell: cmd.shell, |
| 194 | }); |
| 195 | child.once('error', (err) => { |
| 196 | if (settled) return; |
| 197 | settled = true; |
| 198 | reject(err); |
| 199 | }); |
| 200 | child.once('spawn', () => { |
| 201 | if (settled) return; |
| 202 | settled = true; |
| 203 | child.unref(); |
| 204 | resolve(); |
| 205 | }); |
| 206 | }); |
| 207 | } |
| 208 | |
| 209 | function resolveEditorCommand(env: Record<string, string | undefined>): string | undefined { |
| 210 | for (const key of ['KIMI_CODE_EDITOR', 'VISUAL', 'EDITOR']) { |
no test coverage detected