Permalink
Browse files

Ensure no stdout output is lost

Fix for issue #120
  • Loading branch information...
1 parent 4207bd4 commit da5c977e0c9fad46b4aaffe1b55bfbf8808fd727 @simondean simondean committed with jbpros Jun 13, 2013
Showing with 2 additions and 17 deletions.
  1. +2 −17 bin/cucumber.js
View
@@ -3,23 +3,8 @@ var Cucumber = require('../lib/cucumber');
var cli = Cucumber.Cli(process.argv);
cli.run(function(succeeded) {
var code = succeeded ? 0 : 1;
- var exitFunction = function() {
- process.exit(code);
- };
- // --- exit after waiting for all pending output ---
- var waitingIO = false;
- process.stdout.on('drain', function() {
- if (waitingIO) {
- // the kernel buffer is now empty
- exitFunction();
- }
+ process.on('exit', function() {
+ process.exit(code);
});
- if (process.stdout.write("")) {
- // no buffer left, exit now:
- exitFunction();
- } else {
- // write() returned false, kernel buffer is not empty yet...
- waitingIO = true;
- }
});

0 comments on commit da5c977

Please sign in to comment.