MCPcopy
hub / github.com/Fission-AI/OpenSpec / runCommand

Function runCommand

test/helpers/run-cli.ts:35–54  ·  view source on GitHub ↗
(command: string, args: string[], options: RunCommandOptions = {})

Source from the content-addressed store, hash-verified

33}
34
35function runCommand(command: string, args: string[], options: RunCommandOptions = {}) {
36 return new Promise<void>((resolve, reject) => {
37 const child = spawn(command, args, {
38 cwd: options.cwd ?? projectRoot,
39 env: { ...process.env, ...options.env },
40 stdio: 'inherit',
41 shell: process.platform === 'win32',
42 });
43
44 child.on('error', (error) => reject(error));
45 child.on('close', (code, signal) => {
46 if (code === 0) {
47 resolve();
48 } else {
49 const reason = signal ? `signal ${signal}` : `exit code ${code}`;
50 reject(new Error(`Command failed (${reason}): ${command} ${args.join(' ')}`));
51 }
52 });
53 });
54}
55
56export async function ensureCliBuilt() {
57 if (existsSync(cliEntry)) {

Callers 1

ensureCliBuiltFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected