Skip to content

Commit

Permalink
Merge pull request #4863 from eslint/issue4691
Browse files Browse the repository at this point in the history
Fix: Set proper exit code for Node > 0.10 (fixes #4691)
  • Loading branch information
ilyavolodin committed Jan 6, 2016
2 parents 407f329 + 688f277 commit 3c6d818
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions bin/eslint.js
Expand Up @@ -60,10 +60,16 @@ if (useStdIn) {
exitCode = cli.execute(process.argv);
}

/*
* Wait for the stdout buffer to drain.
* See https://github.com/eslint/eslint/issues/317
*/
process.on("exit", function() {
process.exit(exitCode);
});
// https://github.com/eslint/eslint/issues/4691
// In Node.js >= 0.12, you can use a cleaner way
if ("exitCode" in process) {
process.exitCode = exitCode;
} else {
/*
* Wait for the stdout buffer to drain.
* See https://github.com/eslint/eslint/issues/317
*/
process.on("exit", function() {
process.exit(exitCode);
});
}

0 comments on commit 3c6d818

Please sign in to comment.