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

Function spawnProcess

benchmark/permission/permission-startup.js:25–46  ·  view source on GitHub ↗
(script, bench, state)

Source from the content-addressed store, hash-verified

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

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…