summaryrefslogtreecommitdiffstatshomepage
path: root/tools/local-env
diff options
context:
space:
mode:
authorJohn Blackbourn <johnbillion@git.wordpress.org>2025-01-17 10:35:41 +0000
committerJohn Blackbourn <johnbillion@git.wordpress.org>2025-01-17 10:35:41 +0000
commitf1dc1916a0a3b13a9ace369e8bf850cc03c8690c (patch)
tree15344f984d790307af74683c0772323b0bab41fa /tools/local-env
parente8fc0d6ae5d936557f38d4187db5d47df0f1c835 (diff)
downloadwordpress-f1dc1916a0a3b13a9ace369e8bf850cc03c8690c.tar.gz
wordpress-f1dc1916a0a3b13a9ace369e8bf850cc03c8690c.zip
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
Diffstat (limited to 'tools/local-env')
-rw-r--r--tools/local-env/scripts/docker.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/local-env/scripts/docker.js b/tools/local-env/scripts/docker.js
index daa6b88262..c1dc2b27e1 100644
--- a/tools/local-env/scripts/docker.js
+++ b/tools/local-env/scripts/docker.js
@@ -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 );
+}