Skip to content

Commit

Permalink
Fix exit code and ELIFECYCLE error
Browse files Browse the repository at this point in the history
Due to race condition (process.exit() called multiple times) sometimes process fails with error ELIFECYCLE. In that case process exits with exit code 0 but should exit with exit code 2. This change ensures that the race condition can not happened.
  • Loading branch information
polomsky committed Jul 25, 2017
1 parent c8732c8 commit bb7d69d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/webpack.js
Expand Up @@ -350,16 +350,14 @@ function processOptions(options) {
process.stdout.write(statsString + "\n");
}
if(!options.watch && stats.hasErrors()) {
process.on("exit", function() {
process.exit(2); // eslint-disable-line
});
process.exitCode = 2;
}
}
if(firstOptions.watch || options.watch) {
var watchOptions = firstOptions.watchOptions || firstOptions.watch || options.watch || {};
if(watchOptions.stdin) {
process.stdin.on("end", function() {
process.exit(0); // eslint-disable-line
process.exit(); // eslint-disable-line
});
process.stdin.resume();
}
Expand Down

0 comments on commit bb7d69d

Please sign in to comment.