Skip to content
Permalink
Browse files

Fix: Set proper exit code for Node > 0.10 (fixes #4691)

  • Loading branch information...
nzakas committed Jan 6, 2016
1 parent 2c113ba commit 688f277162c8bde48b5978b1f3fc4753a2224f2e
Showing with 13 additions and 7 deletions.
  1. +13 −7 bin/eslint.js
@@ -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 688f277

Please sign in to comment.
You can’t perform that action at this time.