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

Function runCommand

test/unit/cli/cli.integration.spec.ts:99–127  ·  view source on GitHub ↗
(command: string, args: string[])

Source from the content-addressed store, hash-verified

97}
98
99const runCommand = (command: string, args: string[]): Promise<CliResult> => {
100 return new Promise((resolve, reject) => {
101 const child = spawn(command, args, {
102 cwd: projectRoot,
103 env: process.env,
104 stdio: 'pipe',
105 })
106
107 let stdout = ''
108 let stderr = ''
109
110 child.stdout.on('data', (chunk) => {
111 stdout += chunk.toString()
112 })
113
114 child.stderr.on('data', (chunk) => {
115 stderr += chunk.toString()
116 })
117
118 child.on('error', reject)
119 child.on('close', (code) => {
120 resolve({
121 code: code ?? 1,
122 stdout,
123 stderr,
124 })
125 })
126 })
127}
128
129describe('cli integration (spawn)', function () {
130 this.timeout(30000)

Callers 1

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected