node/test/parallel/test-child-process-fork-url.mjs
Antoine du Hamel 81812bad7b
child_process: add support for URL to cp.fork
PR-URL: https://github.com/nodejs/node/pull/41225
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-12-19 22:40:53 +00:00

12 lines
289 B
JavaScript

import { mustCall } from '../common/index.mjs';
import { fork } from 'child_process';
if (process.argv[2] === 'child') {
process.disconnect();
} else {
const child = fork(new URL(import.meta.url), ['child']);
child.on('disconnect', mustCall());
child.once('exit', mustCall());
}