Skip to content

Ensure no stdout output is lost #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ rvm: "1.9.2"
before_script: "git submodule update --init && npm install"
script: "rake"

language: node_js

node_js:
- "0.6"
- "0.8"
- "0.10"
- "0.8"
- "0.6"

branches:
only:
Expand Down
19 changes: 2 additions & 17 deletions bin/cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});