mirror of
https://github.com/nodejs/node.git
synced 2026-11-15 10:36:53 -05:00
worker: move terminate callback to end-of-life
Passing a callback to worker.terminate() has been deprecated for about six years now. It's time to remove it. PR-URL: https://github.com/nodejs/node/pull/58528 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
1 parent
d33f4b539a
commit
411cc42d22
4 files changed
+11
-26
No files matched your search
@@ -12,14 +12,6 @@ process.nextTick(() => {
|
||||
});
|
||||
`, { eval: true });
|
||||
|
||||
// Test deprecation of .terminate() with callback.
|
||||
common.expectWarning(
|
||||
'DeprecationWarning',
|
||||
'Passing a callback to worker.terminate() is deprecated. ' +
|
||||
'It returns a Promise instead.', 'DEP0132');
|
||||
|
||||
w.on('message', common.mustCall(() => {
|
||||
setTimeout(() => {
|
||||
w.terminate(common.mustCall()).then(common.mustCall());
|
||||
}, 1);
|
||||
setTimeout(() => w.terminate().then(common.mustCall()), 1);
|
||||
}));
|
||||
@@ -15,9 +15,7 @@ process.once('beforeExit', common.mustCall(() => worker.ref()));
|
||||
|
||||
worker.on('exit', common.mustCall(() => {
|
||||
worker.terminate().then((res) => assert.strictEqual(res, undefined));
|
||||
worker.terminate(() => null).then(
|
||||
(res) => assert.strictEqual(res, undefined)
|
||||
);
|
||||
|
||||
}));
|
||||
|
||||
worker.unref();
|
||||
Reference in new issue
Block a user