MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/child_process/child-process-spawn-options.js:20–43  ·  view source on GitHub ↗
({ n, envc, argc })

Source from the content-addressed store, hash-verified

18});
19
20function main({ n, envc, argc }) {
21 const env = { ...process.env };
22 for (let i = 0; i < envc; i++)
23 env[`NODE_BENCH_VAR_${i}`] = `value_${i}`;
24
25 const args = baseArgs.slice();
26 for (let i = 0; i < argc; i++)
27 args.push(`arg_${i}`);
28
29 const options = { env, stdio: ['ignore', 'ignore', 'ignore'] };
30
31 let left = n;
32 const go = () => {
33 if (--left < 0)
34 return bench.end(n);
35 const child = spawn(command, args, options);
36 // The exit code is intentionally ignored: the child only exercises the
37 // option-marshaling path, it is not expected to do any useful work.
38 child.on('exit', go);
39 };
40
41 bench.start();
42 go();
43}

Callers

nothing calls this directly

Calls 4

goFunction · 0.70
sliceMethod · 0.65
pushMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected