(program: string, args: string[] = [], continueOn?: string, skipLogging?: boolean, cancellationToken?: vscode.CancellationToken)
| 770 | } |
| 771 | |
| 772 | export async function spawnChildProcess(program: string, args: string[] = [], continueOn?: string, skipLogging?: boolean, cancellationToken?: vscode.CancellationToken): Promise<ProcessReturnType> { |
| 773 | // Do not use CppSettings to avoid circular require() |
| 774 | if (skipLogging === undefined || !skipLogging) { |
| 775 | getOutputChannelLogger().appendLineAtLevel(5, `$ ${program} ${args.join(' ')}`); |
| 776 | } |
| 777 | const programOutput: ProcessOutput = await spawnChildProcessImpl(program, args, continueOn, skipLogging, cancellationToken); |
| 778 | const exitCode: number | NodeJS.Signals | undefined = programOutput.exitCode; |
| 779 | if (programOutput.exitCode) { |
| 780 | return { succeeded: false, exitCode, outputError: programOutput.stderr, output: programOutput.stderr || programOutput.stdout || localize('process.exited', 'Process exited with code {0}', exitCode) }; |
| 781 | } else { |
| 782 | let stdout: string; |
| 783 | if (programOutput.stdout.length) { |
| 784 | // Type system doesn't work very well here, so we need call toString |
| 785 | stdout = programOutput.stdout; |
| 786 | } else { |
| 787 | stdout = localize('process.succeeded', 'Process executed successfully.'); |
| 788 | } |
| 789 | return { succeeded: true, exitCode, outputError: programOutput.stderr, output: stdout }; |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | interface ProcessOutput { |
| 794 | exitCode?: number | NodeJS.Signals; |
nothing calls this directly
no test coverage detected