Skip to content

Commit

Permalink
do not recursively call process.exit() (#3684)
Browse files Browse the repository at this point in the history
* do not recursively call `process.exit()`

When inside `process.on('exit')`, calling `process.exit()`
stops other `exit` event listeners from being invoked.

This has lead to issues with coverage generation with `nyc`
because a fallback exit detection mechanism in it that relies
on internal Node.js APIs was accidentally disabled in Node v11.7.0,
leaving `nyc` with no way to detect process exit.

Refs: nodejs/node#25650

* Revert "pin default Node.js version to v11.6.0 in .travis.yml"

This reverts commit 1abfef6.
  • Loading branch information
addaleax authored and boneskull committed Jan 23, 2019
1 parent 1abfef6 commit 0f95a7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -11,7 +11,7 @@ stages:

# defaults
language: node_js
node_js: '11.6'
node_js: '11'
addons:
apt:
packages:
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/run-helpers.js
Expand Up @@ -25,7 +25,7 @@ const cwd = (exports.cwd = process.cwd());
*/
const exitMochaLater = code => {
process.on('exit', () => {
process.exit(Math.min(code, 255));
process.exitCode = Math.min(code, 255);
});
};

Expand Down

0 comments on commit 0f95a7d

Please sign in to comment.