MCPcopy
hub / github.com/sindresorhus/execa / nestedInstance

Function nestedInstance

test/helpers/nested.js:21–46  ·  view source on GitHub ↗
(file, commandArguments, options, parentOptions)

Source from the content-addressed store, hash-verified

19};
20
21export const nestedInstance = (file, commandArguments, options, parentOptions) => {
22 [commandArguments, options = {}, parentOptions = {}] = Array.isArray(commandArguments)
23 ? [commandArguments, options, parentOptions]
24 : [[], commandArguments, options];
25 const {
26 parentFixture = 'nested.js',
27 worker = false,
28 isSync = false,
29 optionsFixture,
30 optionsInput = {},
31 ...otherOptions
32 } = options;
33 const normalizedArguments = {
34 parentFixture,
35 parentOptions,
36 isSync,
37 file,
38 commandArguments,
39 options: otherOptions,
40 optionsFixture,
41 optionsInput,
42 };
43 return worker
44 ? spawnWorker(normalizedArguments)
45 : spawnParentProcess(normalizedArguments);
46};
47
48const spawnWorker = async workerData => {
49 const worker = new Worker(WORKER_URL, {workerData});

Callers 3

ipc.jsFile · 0.90
nestedSubprocessFunction · 0.85

Calls 2

spawnWorkerFunction · 0.85
spawnParentProcessFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…