Skip to content

Commit 5a9c76f

Browse files
committedDec 18, 2019
Require Node.js 10
1 parent df08cfb commit 5a9c76f

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed
 

‎.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ node_js:
77
- '13'
88
- '12'
99
- '10'
10-
- '8'
1110
after_success:
1211
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'

‎lib/kill.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
const os = require('os');
33
const onExit = require('signal-exit');
4-
const pFinally = require('p-finally');
54

65
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
76

@@ -80,15 +79,15 @@ const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise
8079
}, timeout);
8180
});
8281

83-
const safeSpawnedPromise = pFinally(spawnedPromise, () => {
82+
const safeSpawnedPromise = spawnedPromise.finally(() => {
8483
clearTimeout(timeoutId);
8584
});
8685

8786
return Promise.race([timeoutPromise, safeSpawnedPromise]);
8887
};
8988

9089
// `cleanup` option handling
91-
const setExitHandler = (spawned, {cleanup, detached}, timedPromise) => {
90+
const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
9291
if (!cleanup || detached) {
9392
return timedPromise;
9493
}
@@ -97,8 +96,9 @@ const setExitHandler = (spawned, {cleanup, detached}, timedPromise) => {
9796
spawned.kill();
9897
});
9998

100-
// TODO: Use native "finally" syntax when targeting Node.js 10
101-
return pFinally(timedPromise, removeExitHandler);
99+
return timedPromise.finally(() => {
100+
removeExitHandler();
101+
});
102102
};
103103

104104
module.exports = {

‎lib/promise.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ const mergePromiseProperty = (spawned, promise, property) => {
1717
const mergePromise = (spawned, promise) => {
1818
mergePromiseProperty(spawned, promise, 'then');
1919
mergePromiseProperty(spawned, promise, 'catch');
20-
21-
// TODO: Remove the `if`-guard when targeting Node.js 10
22-
if (Promise.prototype.finally) {
23-
mergePromiseProperty(spawned, promise, 'finally');
24-
}
25-
20+
mergePromiseProperty(spawned, promise, 'finally');
2621
return spawned;
2722
};
2823

‎package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"url": "sindresorhus.com"
1212
},
1313
"engines": {
14-
"node": "^8.12.0 || >=9.7.0"
14+
"node": ">=10"
1515
},
1616
"scripts": {
1717
"test": "xo && nyc ava && tsd"
@@ -46,7 +46,6 @@
4646
"merge-stream": "^2.0.0",
4747
"npm-run-path": "^4.0.0",
4848
"onetime": "^5.1.0",
49-
"p-finally": "^2.0.0",
5049
"signal-exit": "^3.0.2",
5150
"strip-final-newline": "^2.0.0"
5251
},

0 commit comments

Comments
 (0)
Please sign in to comment.