Skip to content

Commit da5c977

Browse files
simondeanjbpros
authored andcommitted
Ensure no stdout output is lost
Fix for issue #120
1 parent 4207bd4 commit da5c977

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

bin/cucumber.js

+2-17
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,8 @@ var Cucumber = require('../lib/cucumber');
33
var cli = Cucumber.Cli(process.argv);
44
cli.run(function(succeeded) {
55
var code = succeeded ? 0 : 1;
6-
var exitFunction = function() {
7-
process.exit(code);
8-
};
96

10-
// --- exit after waiting for all pending output ---
11-
var waitingIO = false;
12-
process.stdout.on('drain', function() {
13-
if (waitingIO) {
14-
// the kernel buffer is now empty
15-
exitFunction();
16-
}
7+
process.on('exit', function() {
8+
process.exit(code);
179
});
18-
if (process.stdout.write("")) {
19-
// no buffer left, exit now:
20-
exitFunction();
21-
} else {
22-
// write() returned false, kernel buffer is not empty yet...
23-
waitingIO = true;
24-
}
2510
});

0 commit comments

Comments
 (0)