MCPcopy Index your code
hub / github.com/angular/dev-infra / spawnInteractive

Function spawnInteractive

ng-dev/utils/child-process.ts:66–80  ·  view source on GitHub ↗

* 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 = {},
  )

Source from the content-addressed store, hash-verified

64 * @returns a Promise resolving on success, and rejecting on command failure with the status code.
65 */
66 static spawnInteractive(
67 command: string,
68 args: string[],
69 options: SpawnInteractiveCommandOptions = {},
70 ) {
71 return new Promise<void>((resolve, reject) => {
72 const commandText = `${command} ${args.join(' ')}`;
73 Log.debug(`Executing command: ${sanitize(commandText)}`);
74 const childProcess = _spawn(command, args, {...options, stdio: 'inherit'});
75 // The `close` event is used because the process is guaranteed to have completed writing to
76 // stdout and stderr, using the `exit` event can cause inconsistent information in stdout and
77 // stderr due to a race condition around exiting.
78 childProcess.on('close', (status) => (status === 0 ? resolve() : reject(status)));
79 });
80 }
81
82 /**
83 * Spawns a given command with the specified arguments inside a shell synchronously.

Callers

nothing calls this directly

Calls 3

sanitizeFunction · 0.85
resolveFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected