* Spawns a given command with the specified arguments inside an interactive shell. All process * stdin, stdout and stderr output is printed to the current console. * * @returns a Promise resolving on success, and rejecting on command failure with the status code.
(
command: string,
args: string[],
options: SpawnInteractiveCommandOptions = {},
)
| 64 | * Spawns a given command with the specified arguments inside an interactive shell. All process |
| 65 | * stdin, stdout and stderr output is printed to the current console. |
| 66 | * |
| 67 | * @returns a Promise resolving on success, and rejecting on command failure with the status code. |
| 68 | */ |
| 69 | static spawnInteractive( |
| 70 | command: string, |
| 71 | args: string[], |
| 72 | options: SpawnInteractiveCommandOptions = {}, |
| 73 | ) { |
| 74 | return new Promise<void>((resolve, reject) => { |
| 75 | const commandText = `${command} ${args.join(' ')}`; |
| 76 | const env = sanitizeEnvironmentPath( |
| 77 | options.env ?? process.env, |
| 78 | getExcludedDirsForCwd(options.cwd), |
| 79 | ); |
| 80 | Log.debug(`Executing command: ${sanitize(commandText)}`); |
| 81 | const childProcess = _spawn(command, args, {...options, env, stdio: 'inherit'}); |
| 82 | childProcess.on('error', (err) => { |
| 83 | const sanitizedErr = sanitizeError(err); |