MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / launchDetached

Function launchDetached

packages/server/src/lib/fileLaunch.ts:187–207  ·  view source on GitHub ↗
(cmd: LaunchCommand)

Source from the content-addressed store, hash-verified

185}
186
187export 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
209function resolveEditorCommand(env: Record<string, string | undefined>): string | undefined {
210 for (const key of ['KIMI_CODE_EDITOR', 'VISUAL', 'EDITOR']) {

Callers 3

handleOpenFunction · 0.90
handleRevealFunction · 0.90
handleOpenInFunction · 0.90

Calls 4

rejectFunction · 0.85
onceMethod · 0.65
spawnFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected