MCPcopy Index your code
hub / github.com/cameri/nostream / runCommand

Function runCommand

src/cli/utils/process.ts:14–39  ·  view source on GitHub ↗
(command: string, args: string[], options: RunOptions = {})

Source from the content-addressed store, hash-verified

12 | { ok: false; reason: 'not-found' | 'permission-denied' | 'spawn-error' | 'timeout' | 'signal'; stdout: string; stderr: string }
13
14export const runCommand = (command: string, args: string[], options: RunOptions = {}): Promise<number> => {
15 return new Promise((resolve, reject) => {
16 const child = spawn(command, args, {
17 cwd: options.cwd,
18 env: { ...process.env, ...(options.env ?? {}) },
19 stdio: options.stdio ?? 'inherit',
20 shell: false,
21 })
22
23 const timer =
24 typeof options.timeoutMs === 'number'
25 ? setTimeout(() => {
26 child.kill('SIGTERM')
27 }, options.timeoutMs)
28 : undefined
29
30 child.on('error', reject)
31 child.on('close', (code) => {
32 if (timer) {
33 clearTimeout(timer)
34 }
35
36 resolve(code ?? 1)
37 })
38 })
39}
40
41export const runCommandWithOutput = (
42 command: string,

Callers 12

runDockerComposeFunction · 0.90
ensureNginxBootstrapFunction · 0.90
runSeedFunction · 0.90
runUpdateFunction · 0.90
runDevDbResetFunction · 0.90
runDevSeedRelayFunction · 0.90
runDevDockerCleanFunction · 0.90
runDevTestUnitFunction · 0.90
runDevTestCliFunction · 0.90
runDevTestIntegrationFunction · 0.90
runDevTestPerfConnectionFunction · 0.90
runDevTestPerfMessageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected