Skip to content

Commit 3d6d5ac

Browse files
committed
fix(ng-dev): only log failures to when on actual failing exit codes when on-error mode is set
Previously `on-error` would always log because we didn't check to confirm the exit code as actually indicating an error (i.e. != 0)
1 parent 2562f2b commit 3d6d5ac

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ng-dev/utils/child-process.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export interface CommonCmdOpts {
3131

3232
/** Interface describing the options for spawning a process synchronously. */
3333
export interface SpawnSyncOptions
34-
extends CommonCmdOpts,
35-
Omit<_SpawnSyncOptions, 'shell' | 'stdio' | 'input'> {}
34+
extends CommonCmdOpts, Omit<_SpawnSyncOptions, 'shell' | 'stdio' | 'input'> {}
3635

3736
/** Interface describing the options for spawning a process. */
3837
export interface SpawnOptions extends CommonCmdOpts, Omit<_SpawnOptions, 'shell' | 'stdio'> {}
@@ -222,9 +221,8 @@ function processAsyncCmd(
222221
// stderr due to a race condition around exiting.
223222
childProcess.on('close', (exitCode, signal) => {
224223
const exitDescription = exitCode !== null ? `exit code "${exitCode}"` : `signal "${signal}"`;
225-
const printFn = options.mode === 'on-error' ? Log.error : Log.debug;
226224
const status = statusFromExitCodeAndSignal(exitCode, signal);
227-
225+
const printFn = status !== 0 && options.mode === 'on-error' ? Log.error : Log.debug;
228226
printFn(`Command "${command}" completed with ${exitDescription}.`);
229227
printFn(`Process output: \n${logOutput}`);
230228

0 commit comments

Comments
 (0)