Skip to content

Commit f1dc191

Browse files
committed
Build/Test Tools: Hide the Node.js error message when a Docker command produces a non-zero exit code.
When running a command that goes via docker.js and produces a non-zero exit code, the error message and stack trace from node an safely be hidden because the stack trace only points to the `execSync()` call and is of no use. Fixes #62814 git-svn-id: https://develop.svn.wordpress.org/trunk@59659 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e8fc0d6 commit f1dc191

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/local-env/scripts/docker.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ if (process.argv.includes('--coverage-html')) {
1212
process.env.LOCAL_PHP_XDEBUG_MODE = 'coverage';
1313
}
1414

15-
// Execute any docker compose command passed to this script.
16-
execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
15+
// This try-catch prevents the superfluous Node.js debugging information from being shown if the command fails.
16+
try {
17+
// Execute any Docker compose command passed to this script.
18+
execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
19+
} catch ( error ) {
20+
process.exit( 1 );
21+
}

0 commit comments

Comments
 (0)