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

Function spawnProcess

benchmark/misc/startup-core.js:20–41  ·  view source on GitHub ↗
(script, bench, state)

Source from the content-addressed store, hash-verified

18});
19
20function spawnProcess(script, bench, state) {
21 const cmd = process.execPath || process.argv[0];
22 while (state.finished < state.n) {
23 const child = spawnSync(cmd, [script]);
24 if (child.status !== 0) {
25 console.log('---- STDOUT ----');
26 console.log(child.stdout.toString());
27 console.log('---- STDERR ----');
28 console.log(child.stderr.toString());
29 throw new Error(`Child process stopped with exit code ${child.status}`);
30 }
31 state.finished++;
32 if (state.finished === 0) {
33 // Finished warmup.
34 bench.start();
35 }
36
37 if (state.finished === state.n) {
38 bench.end(state.n);
39 }
40 }
41}
42
43function spawnWorker(script, bench, state) {
44 const child = new Worker(script);

Callers 1

mainFunction · 0.70

Calls 5

spawnSyncFunction · 0.50
logMethod · 0.45
toStringMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…