Skip to content

Commit

Permalink
Remove workaround for worker.terminate() crashes
Browse files Browse the repository at this point in the history
Looks like the patch is included in all supported Node.js versions.
  • Loading branch information
novemberborn committed Jul 3, 2023
1 parent 10e2e8a commit 7533020
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {fileURLToPath} from 'node:url';
import {Worker} from 'node:worker_threads';

import Emittery from 'emittery';
import {pEvent} from 'p-event';

import {controlFlow} from './ipc-flow-control.cjs';
import serializeError from './serialize-error.js';
Expand Down Expand Up @@ -35,13 +34,8 @@ const createWorker = (options, execArgv) => {
});
postMessage = worker.postMessage.bind(worker);

// Ensure we've seen this event before we terminate the worker thread, as a
// workaround for https://github.com/nodejs/node/issues/38418.
const starting = pEvent(worker, 'message', ({ava}) => ava?.type === 'starting');

close = async () => {
try {
await starting;
await worker.terminate();
} finally {
// No-op
Expand Down

0 comments on commit 7533020

Please sign in to comment.