MCPcopy Index your code
hub / github.com/nodejs/node / spawn

Function spawn

test/parallel/test-child-process-spawnsync-kill-signal.js:14–29  ·  view source on GitHub ↗
(killSignal, beforeSpawn)

Source from the content-addressed store, hash-verified

12 const { SIGKILL } = require('os').constants.signals;
13
14 function spawn(killSignal, beforeSpawn) {
15 if (beforeSpawn) {
16 internalCp.spawnSync = common.mustCall(function(opts) {
17 beforeSpawn(opts);
18 return oldSpawnSync(opts);
19 });
20 }
21 const child = cp.spawnSync(process.execPath,
22 [__filename, 'child'],
23 { killSignal, timeout: 100 });
24 if (beforeSpawn)
25 internalCp.spawnSync = oldSpawnSync;
26 assert.strictEqual(child.status, null);
27 assert.strictEqual(child.error.code, 'ETIMEDOUT');
28 return child;
29 }
30
31 // Verify that an error is thrown for unknown signals.
32 assert.throws(() => {

Calls

no outgoing calls

Tested by 6

testFunction · 0.56
testFunction · 0.56
testFunction · 0.56
testFunction · 0.56
testFunction · 0.56
testFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…