Skip to content

Commit a15d4a9

Browse files
authored
Merge pull request webpack#5370 from polomsky/master
Fix exit code and ELIFECYCLE error
2 parents dcaf0bb + 5bbb183 commit a15d4a9

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

bin/webpack.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,14 @@ function processOptions(options) {
350350
process.stdout.write(statsString + "\n");
351351
}
352352
if(!options.watch && stats.hasErrors()) {
353-
process.on("exit", function() {
354-
process.exit(2); // eslint-disable-line
355-
});
353+
process.exitCode = 2;
356354
}
357355
}
358356
if(firstOptions.watch || options.watch) {
359357
var watchOptions = firstOptions.watchOptions || firstOptions.watch || options.watch || {};
360358
if(watchOptions.stdin) {
361359
process.stdin.on("end", function() {
362-
process.exit(0); // eslint-disable-line
360+
process.exit(); // eslint-disable-line
363361
});
364362
process.stdin.resume();
365363
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
}

test/binCases/errors/parse/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use strict";
2+
3+
module.exports = function testAssertions(code, stdout, stderr) {
4+
code.should.be.eql(2);
5+
6+
console.log(stdout);
7+
stdout[0].should.containEql("Hash: ");
8+
stdout[1].should.containEql("Version: ");
9+
stdout[2].should.containEql("Time: ");
10+
stdout[5].should.containEql("./index.js");
11+
stdout[5].should.containEql("[built]");
12+
stdout[5].should.containEql("[failed]");
13+
stdout[5].should.containEql("[1 error]");
14+
stdout[7].should.containEql("ERROR in ./index.js");
15+
stdout[8].should.containEql("Module parse failed:");
16+
17+
stderr.should.be.empty();
18+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
context: __dirname,
3+
entry: "./index"
4+
};

0 commit comments

Comments
 (0)