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
This commit is contained in:
John Blackbourn 2025-01-17 10:35:41 +00:00
parent e8fc0d6ae5
commit f1dc1916a0

View File

@ -12,5 +12,10 @@ if (process.argv.includes('--coverage-html')) {
process.env.LOCAL_PHP_XDEBUG_MODE = 'coverage';
}
// Execute any docker compose command passed to this script.
execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
// This try-catch prevents the superfluous Node.js debugging information from being shown if the command fails.
try {
// Execute any Docker compose command passed to this script.
execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
} catch ( error ) {
process.exit( 1 );
}