MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / spawnScript

Function spawnScript

apps/local/src/db/data-dir-ownership.test.ts:66–87  ·  view source on GitHub ↗
(code: string, env: Record<string, string>)

Source from the content-addressed store, hash-verified

64`;
65
66const spawnScript = (code: string, env: Record<string, string>): ChildOutput => {
67 const child = spawn(process.execPath, ["-e", code], {
68 cwd: appRoot,
69 env: {
70 ...process.env,
71 NODE_ENV: "test",
72 ...env,
73 },
74 stdio: "pipe",
75 });
76
77 const output: ChildOutput = { child, stdout: "", stderr: "" };
78 child.stdout.setEncoding("utf-8");
79 child.stderr.setEncoding("utf-8");
80 child.stdout.on("data", (chunk: string) => {
81 output.stdout += chunk;
82 });
83 child.stderr.on("data", (chunk: string) => {
84 output.stderr += chunk;
85 });
86 return output;
87};
88
89const waitForChildClose = async (
90 output: ChildOutput,

Callers 2

runAcquireAttemptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected