Skip to content

Commit

Permalink
Scripts: exit error code 1 when status value is null (#42396)
Browse files Browse the repository at this point in the history
* handle case when status is null

this commit is done to fix pipeline exit in case of failure. status value
is `null` in case of failure

* fix OR condition

* fix process.exit condition if status is `null`

* Update CHANGELOG.md

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
  • Loading branch information
amustaque97 and gziolo committed Jul 14, 2022
1 parent cd518a1 commit 417c23b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fix

- Fix the incorrect exit error code when status missing in `webpack` call for `build` and `start` commands ([#42396](https://github.com/WordPress/gutenberg/pull/42396)).

## 23.3.0 (2022-06-15)

### Enhancements
Expand Down
3 changes: 2 additions & 1 deletion packages/scripts/scripts/build.js
Expand Up @@ -8,6 +8,7 @@ const { sync: resolveBin } = require( 'resolve-bin' );
* Internal dependencies
*/
const { getWebpackArgs, hasArgInCLI, getArgFromCLI } = require( '../utils' );
const EXIT_ERROR_CODE = 1;

process.env.NODE_ENV = process.env.NODE_ENV || 'production';

Expand All @@ -30,4 +31,4 @@ process.env.WP_SRC_DIRECTORY = hasArgInCLI( '--webpack-src-dir' )
const { status } = spawn( resolveBin( 'webpack' ), getWebpackArgs(), {
stdio: 'inherit',
} );
process.exit( status );
process.exit( status === null ? EXIT_ERROR_CODE : status );
3 changes: 2 additions & 1 deletion packages/scripts/scripts/start.js
Expand Up @@ -8,6 +8,7 @@ const { sync: resolveBin } = require( 'resolve-bin' );
* Internal dependencies
*/
const { getArgFromCLI, getWebpackArgs, hasArgInCLI } = require( '../utils' );
const EXIT_ERROR_CODE = 1;

if ( hasArgInCLI( '--webpack-no-externals' ) ) {
process.env.WP_NO_EXTERNALS = true;
Expand Down Expand Up @@ -36,4 +37,4 @@ const { status } = spawn(
stdio: 'inherit',
}
);
process.exit( status );
process.exit( status === null ? EXIT_ERROR_CODE : status );

0 comments on commit 417c23b

Please sign in to comment.