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

Function commandForExecFile

apps/kimi-code/scripts/native/exec.mjs:9–21  ·  view source on GitHub ↗
(command, args, platform = process.platform, env = process.env)

Source from the content-addressed store, hash-verified

7const execFileAsync = promisify(execFile);
8
9export function commandForExecFile(command, args, platform = process.platform, env = process.env) {
10 if (platform !== 'win32' || !/\.(?:bat|cmd)$/i.test(command)) {
11 return { command, args };
12 }
13 const shellCommand = [command, ...args]
14 .map((arg) => `"${String(arg).replaceAll('"', '""')}"`)
15 .join(' ');
16 return {
17 command: env.ComSpec ?? 'cmd.exe',
18 args: ['/d', '/s', '/c', `"${shellCommand}"`],
19 options: { windowsVerbatimArguments: true },
20 };
21}
22
23export function fail(message) {
24 console.error(message);

Callers 3

exec.test.tsFile · 0.90
runFunction · 0.85
tryRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected