MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / runScript

Function runScript

scripts/feishu/run-db-tests.test.mjs:75–110  ·  view source on GitHub ↗
(args, env)

Source from the content-addressed store, hash-verified

73});
74
75function runScript(args, env) {
76 return new Promise((resolvePromise) => {
77 const child = spawn(process.execPath, [scriptPath, ...args], {
78 cwd: repositoryRoot,
79 env: {
80 ...process.env,
81 ...env,
82 },
83 stdio: ["ignore", "pipe", "pipe"],
84 });
85 let stdout = "";
86 let stderr = "";
87 child.stdout.setEncoding("utf8");
88 child.stderr.setEncoding("utf8");
89 child.stdout.on("data", (chunk) => {
90 stdout += chunk;
91 });
92 child.stderr.on("data", (chunk) => {
93 stderr += chunk;
94 });
95 child.once("exit", (code) => {
96 resolvePromise({
97 code: code ?? 1,
98 stderr,
99 stdout,
100 });
101 });
102 child.once("error", (error) => {
103 resolvePromise({
104 code: 1,
105 stderr: error instanceof Error ? error.message : String(error),
106 stdout,
107 });
108 });
109 });
110}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected