ipc-send-pid.js
This file
Path
test/fixtures/ipc-send-pid.js
22 lines · 578 bytes · JavaScript
Last changed by
Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
History of this fileTake it
1234567891011121314151617181920212223#!/usr/bin/env nodeimport process from 'node:process';import {execa, sendMessage} from '../../index.js';
const isCleanup = process.argv[2] === 'true';const isDetached = process.argv[3] === 'true';const file = process.argv[4] === 'no-killable' ? 'no-killable.js' : 'forever.js';const options = { cleanup: isCleanup, detached: isDetached, ...(file === 'no-killable.js' && { ipc: true, killSignal: 'SIGKILL', }),};const subprocess = execa(file, options);if (options.ipc) { await subprocess.getOneMessage();}
await sendMessage(subprocess.pid);await subprocess;