MCPcopy Create free account
hub / github.com/continuedev/continue / runCommand

Function runCommand

scripts/build-packages.js:8–49  ·  view source on GitHub ↗
(command, cwd, packageName)

Source from the content-addressed store, hash-verified

6const npmInstallCmd = process.env.CI === "true" ? "npm ci" : "npm install";
7
8function runCommand(command, cwd, packageName) {
9 return new Promise((resolve, reject) => {
10 console.log(`Starting ${packageName}: ${command}`);
11
12 const [cmd, ...args] = command.split(" ");
13 const child = spawn(cmd, args, {
14 cwd,
15 stdio: "pipe",
16 shell: true,
17 });
18
19 let stdout = "";
20 let stderr = "";
21
22 child.stdout.on("data", (data) => {
23 stdout += data.toString();
24 });
25
26 child.stderr.on("data", (data) => {
27 stderr += data.toString();
28 });
29
30 child.on("close", (code) => {
31 if (code === 0) {
32 console.log(`✅ ${packageName}: ${command} completed successfully`);
33 resolve({ packageName, command, stdout, stderr });
34 } else {
35 console.error(`❌ ${packageName}: ${command} failed with code ${code}`);
36 console.error(`stderr: ${stderr}`);
37 console.error(`stdout: ${stdout}`);
38 reject(
39 new Error(`${packageName} failed: ${command} (exit code ${code})`),
40 );
41 }
42 });
43
44 child.on("error", (error) => {
45 console.error(`❌ ${packageName}: Failed to start ${command}:`, error);
46 reject(error);
47 });
48 });
49}
50
51// Helper function to build a package (install + build)
52async function buildPackage(packageName, cleanNodeModules = false) {

Callers 1

buildPackageFunction · 0.85

Calls 3

errorMethod · 0.80
logMethod · 0.65
onMethod · 0.65

Tested by

no test coverage detected