This commit is contained in:
Ben Grant
2025-06-02 14:42:10 -07:00
parent 067dcab6d2
commit bca78ac3a9
2 changed files with 0 additions and 30 deletions

View File

@@ -1,14 +0,0 @@
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
const w = new Worker(`
const dns = require('dns');
dns.lookup('nonexistent.org', () => {});
require('worker_threads').parentPort.postMessage('0');
`, { eval: true });
w.on('message', common.mustCall(() => {
// This should not crash the worker during a DNS request.
w.terminate().then(common.mustCall());
}));

View File

@@ -1,16 +0,0 @@
'use strict';
const common = require('../common');
const { once } = require('events');
const { Worker } = require('worker_threads');
// Test that calling worker.terminate() on an unref()ed Worker instance
// still resolves the returned Promise.
async function test() {
const worker = new Worker('setTimeout(() => {}, 1000000);', { eval: true });
await once(worker, 'online');
worker.unref();
await worker.terminate();
}
test().then(common.mustCall());