Skip to content

Commit 047455b

Browse files
committed
Exit with code 255 if more errors than 255 were returned. Fixes #2438
1 parent 7509752 commit 047455b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/_mocha

+2-2
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,15 @@ if (program.watch) {
405405
}
406406

407407
function exitLater(code) {
408-
process.on('exit', function() { process.exit(code) })
408+
process.on('exit', function() { process.exit(Math.min(code, 255)) })
409409
}
410410

411411
function exit(code) {
412412
// flush output for Node.js Windows pipe bug
413413
// https://github.com/joyent/node/issues/6247 is just one bug example
414414
// https://github.com/visionmedia/mocha/issues/333 has a good discussion
415415
function done() {
416-
if (!(draining--)) process.exit(code);
416+
if (!(draining--)) process.exit(Math.min(code, 255));
417417
}
418418

419419
var draining = 0;

0 commit comments

Comments
 (0)