Skip to content

Commit

Permalink
Fix unref'ing the timer in some environments (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
nodkz and sindresorhus committed Jan 15, 2020
1 parent 0edd17a commit 0a447b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -53,7 +53,10 @@ module.exports = async options => {
lockedPorts.young = new Set();
}, releaseOldLockedPortsIntervalMs);

interval.unref();
// Does not exist in some environments (Electron, Jest jsdom env, browser, etc).
if (interval.unref) {
interval.unref();
}
}

for (const port of portCheckSequence(ports)) {
Expand Down

0 comments on commit 0a447b1

Please sign in to comment.