Skip to content

Commit

Permalink
Make build exit with error code when interrupted
Browse files Browse the repository at this point in the history
This addresses issue facebook#1493.

Current behavior is that `npm run build` exits code 0 without creating a bundle when interrupted. This change makes the build script catch catchable interruptions and exit with the appropriate error code.
  • Loading branch information
brandones authored Feb 7, 2017
1 parent 65e6340 commit 72750e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/react-scripts/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,15 @@ function copyPublicFolder() {
filter: file => file !== paths.appHtml
});
}

var signals = {
'SIGINT': 2,
'SIGTERM': 15
};

Object.keys(signals).forEach(function (signalName) {
process.on(signalName, function () {
console.log('Build stopped by ' + signalName);
process.exit(signals[signalName]);
});
});

0 comments on commit 72750e6

Please sign in to comment.