Skip to content

Commit 72750e6

Browse files
authored
Make build exit with error code when interrupted
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.
1 parent 65e6340 commit 72750e6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/react-scripts/scripts/build.js

+12
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,15 @@ function copyPublicFolder() {
233233
filter: file => file !== paths.appHtml
234234
});
235235
}
236+
237+
var signals = {
238+
'SIGINT': 2,
239+
'SIGTERM': 15
240+
};
241+
242+
Object.keys(signals).forEach(function (signalName) {
243+
process.on(signalName, function () {
244+
console.log('Build stopped by ' + signalName);
245+
process.exit(signals[signalName]);
246+
});
247+
});

0 commit comments

Comments
 (0)