MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / runCommand

Function runCommand

scripts/electron-binary.ts:32–56  ·  view source on GitHub ↗
(command: string, args: string[])

Source from the content-addressed store, hash-verified

30}
31
32function runCommand(command: string, args: string[]) {
33 return new Promise<void>((resolve, reject) => {
34 const child = spawn(command, args, {
35 cwd: process.cwd(),
36 stdio: 'inherit',
37 env: process.env,
38 })
39
40 child.on('error', reject)
41 child.on('exit', (code, signal) => {
42 if (code === 0) {
43 resolve()
44 return
45 }
46
47 reject(
48 new Error(
49 signal
50 ? `${command} exited with signal ${signal}`
51 : `${command} exited with code ${code ?? 'unknown'}`,
52 ),
53 )
54 })
55 })
56}
57
58export async function ensureElectronBinary() {
59 const binaryPath = tryResolveElectronBinary()

Callers 1

ensureElectronBinaryFunction · 0.85

Calls 2

spawnFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected