in src/help/shell.ts [37:60]
export function run(command: string, options: RunOptions = {}): string {
const shsplit = shlex.split(command);
const pipeOrInherit = (options.capture ?? false) ? 'pipe': 'inherit';
const result = child.spawnSync(shsplit[0], shsplit.slice(1), {
stdio: ['ignore', pipeOrInherit, pipeOrInherit],
cwd: options.cwd,
shell: options.shell,
});
if (result.error) {
throw result.error;
}
const stdout = result.stdout?.toString();
const stderr = result.stderr?.toString();
if (result.status !== 0) {
const message = `
Command failed: ${command}.
Output: ${stdout}
Error:${stderr}`;
throw new Error(message);
}
return stdout;
}