({
command,
args,
platform = process.platform,
}: {
command: string;
args: string[];
platform?: NodeJS.Platform;
})
| 6 | } |
| 7 | |
| 8 | export function createCodexCliLaunchSpec({ |
| 9 | command, |
| 10 | args, |
| 11 | platform = process.platform, |
| 12 | }: { |
| 13 | command: string; |
| 14 | args: string[]; |
| 15 | platform?: NodeJS.Platform; |
| 16 | }): CodexCliLaunchSpec { |
| 17 | if (platform === 'win32' && /\.(cmd|bat)$/iu.test(command)) { |
| 18 | return { |
| 19 | command: buildWindowsShellCommandLine([command, ...args]), |
| 20 | args: null, |
| 21 | options: { |
| 22 | shell: true, |
| 23 | windowsHide: true, |
| 24 | }, |
| 25 | displayCommand: command, |
| 26 | }; |
| 27 | } |
| 28 | return { |
| 29 | command, |
| 30 | args, |
| 31 | options: {}, |
| 32 | displayCommand: command, |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | function buildWindowsShellCommandLine(parts: string[]): string { |
| 37 | return parts.map(quoteWindowsShellArgument).join(' '); |
no test coverage detected