Skip to content

Commit

Permalink
Make sure that cli exits properly, fixes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Apr 2, 2013
1 parent 9f86ac4 commit 0fd982c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions javascript/src/cli/CLI-common.js
Expand Up @@ -107,6 +107,9 @@ YUITest.Util.mix(YUITest.CLI, {

this.processArguments();
this.processFiles();
YUITest.TestRunner.subscribe(YUITest.TestRunner.COMPLETE_EVENT, function(event) {
YUITest.CLI.quit(event.results.failed ? 1 : 0);
});

YUITest.TestRunner.run({
groups: this.options.groups ? this.options.groups.split(",") : null
Expand Down
11 changes: 1 addition & 10 deletions javascript/src/cli/CLI-node.js
Expand Up @@ -42,16 +42,7 @@ YUITest.CLI = {
},

quit: function(code){

//Workaround for https://github.com/joyent/node/issues/1669
var flushed = process.stdout.flush && process.stdout.flush();
if (!flushed && (parseFloat(process.versions.node) < 0.5)) {
process.once("drain", function () {
process.exit(code || 0);
});
} else {
process.exit(code || 0);
}
process.exit(code || 0);
},

isDirectory: function(name) {
Expand Down

0 comments on commit 0fd982c

Please sign in to comment.