MCPcopy Create free account
hub / github.com/6pac/SlickGrid / spawnProcess

Function spawnProcess

scripts/child-process.mjs:96–120  ·  view source on GitHub ↗
(
  command,
  args,
  execOpts,
  cmdDryRun = false
)

Source from the content-addressed store, hash-verified

94 * @returns {Promise<any>}
95 */
96export async function spawnProcess(
97 command,
98 args,
99 execOpts,
100 cmdDryRun = false
101) {
102 if (cmdDryRun) {
103 return logExecDryRunCommand(command, args);
104 }
105 const child = x(command, args, execOpts);
106 const drain = (_code, signal) => {
107 children.delete(child);
108
109 // don't run repeatedly if this is the error event
110 if (signal === undefined) {
111 child.process.removeListener('exit', drain);
112 }
113 };
114
115 child.process.once('exit', drain);
116 child.process.once('error', drain);
117 children.add(child);
118
119 return child;
120}
121
122/**
123 * Spawn a command asynchronously, streaming stdio with optional prefix.

Callers 2

execAsyncPipedFunction · 0.85
spawnStreamingFunction · 0.85

Calls 2

logExecDryRunCommandFunction · 0.85
xFunction · 0.85

Tested by

no test coverage detected