File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,4 +60,13 @@ for ( let attempt = 1; attempt <= maxAttempts; attempt++ ) {
6060 Atomics . wait ( new Int32Array ( new SharedArrayBuffer ( 4 ) ) , 0 , 0 , delay * 1000 ) ;
6161}
6262
63- process . exit ( returns . status ) ;
63+ if ( returns . error ) {
64+ console . error ( `Could not run Docker Compose. ${ returns . error . message } ` ) ;
65+ } else if ( returns . signal && returns . signal !== 'SIGINT' ) {
66+ console . error ( `Docker Compose was terminated by ${ returns . signal } .` ) ;
67+ }
68+
69+ // `status` is null when Docker could not be spawned at all, or was killed by a signal. SIGINT is
70+ // how a long-running command such as `env:logs` is normally ended, so it is not a failure worth an
71+ // npm error block. Every other signal means the command was killed before it finished.
72+ process . exit ( returns . signal === 'SIGINT' ? 0 : ( returns . status ?? 1 ) ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) {
3232 containers . push ( 'memcached' ) ;
3333}
3434
35- spawnSync (
35+ const up = spawnSync (
3636 'docker' ,
3737 [
3838 'compose' ,
@@ -45,6 +45,17 @@ spawnSync(
4545 { stdio : 'inherit' }
4646) ;
4747
48+ // No signal is exempt here, unlike in `docker.js`: `env:start` runs `composer update -W` next, and
49+ // that must not run against containers that never came up.
50+ if ( up . status !== 0 ) {
51+ const reason = up . signal ? `It was terminated by ${ up . signal } .` : up . error ?. message ?? '' ;
52+
53+ console . error ( `Could not start the Docker containers. ${ reason } ` . trim ( ) ) ;
54+
55+ // `status` is null when Docker could not be spawned at all, or was killed by a signal.
56+ process . exit ( up . status ?? 1 ) ;
57+ }
58+
4859// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
4960if ( process . env . DOCKER_TOOLBOX_INSTALL_PATH ) {
5061 // VBoxManage is added to the PATH on every platform except Windows.
You can’t perform that action at this time.
0 commit comments