0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/fixtures/parent-process-nonpersistent-fork.js
timothy searcy f051737ee4 test: test and docs for detached fork process
This tests child process fork component in detached mode
by spawning a parent process that creates a child process.
We kill the parent process and check if the child is still
running.

Fixes: https://github.com/nodejs/node/issues/17592

PR-URL: https://github.com/nodejs/node/pull/24524
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-11-28 11:14:37 -08:00

13 lines
235 B
JavaScript

const fork = require('child_process').fork;
const path = require('path');
const child = fork(
path.join(__dirname, 'child-process-persistent.js'),
[],
{ detached: true, stdio: 'ignore' }
);
console.log(child.pid);
child.unref();