MCPcopy Create free account
hub / github.com/CedarCopilot/cedar-OS / runCommand

Function runCommand

packages/cli/src/utils/runCommand.ts:4–33  ·  view source on GitHub ↗
(
	command: string,
	args: string[],
	options: { cwd?: string; stdio?: 'inherit' | 'pipe' | 'ignore' } = {}
)

Source from the content-addressed store, hash-verified

2
3// Helper function to run shell commands
4export function runCommand(
5 command: string,
6 args: string[],
7 options: { cwd?: string; stdio?: 'inherit' | 'pipe' | 'ignore' } = {}
8): Promise<void> {
9 return new Promise((resolve, reject) => {
10 const child = spawn(command, args, {
11 stdio: options.stdio || 'inherit',
12 cwd: options.cwd || process.cwd(),
13 });
14
15 child.on('close', (code) => {
16 if (code !== 0) {
17 reject(
18 new Error(
19 `Command "${command} ${args.join(
20 ' '
21 )}" failed with exit code ${code}`
22 )
23 );
24 } else {
25 resolve();
26 }
27 });
28
29 child.on('error', (error) => {
30 reject(error);
31 });
32 });
33}

Callers 4

installTailwindCSSFunction · 0.90
handleNpmDependenciesFunction · 0.90
plantSeedCommandFunction · 0.90
addSaplingCommandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected