Make WordPress Core

Changeset 59659


Ignore:
Timestamp:
01/17/2025 10:35:41 AM (5 months ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/local-env/scripts/docker.js

    r59356 r59659  
    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.
     16try {
     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}
Note: See TracChangeset for help on using the changeset viewer.