@11agents/cli 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/runtime.js +13 -5
package/package.json
CHANGED
package/src/commands/runtime.js
CHANGED
|
@@ -20,18 +20,28 @@ function sleep(ms) {
|
|
|
20
20
|
return new Promise(resolve => setTimeout(resolve, ms))
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function runProcess(command, args, { input = '', cwd = process.cwd(), env = process.env } = {}) {
|
|
23
|
+
export function runProcess(command, args, { input = '', cwd = process.cwd(), env = process.env } = {}) {
|
|
24
24
|
return new Promise(resolve => {
|
|
25
|
+
let settled = false
|
|
25
26
|
const child = spawn(command, args, { cwd, env, stdio: ['pipe', 'pipe', 'pipe'] })
|
|
26
27
|
let stdout = ''
|
|
27
28
|
let stderr = ''
|
|
29
|
+
const settle = result => {
|
|
30
|
+
if (settled) return
|
|
31
|
+
settled = true
|
|
32
|
+
resolve(result)
|
|
33
|
+
}
|
|
28
34
|
child.stdout.on('data', chunk => { stdout += chunk })
|
|
29
35
|
child.stderr.on('data', chunk => { stderr += chunk })
|
|
30
36
|
child.on('error', error => {
|
|
31
|
-
|
|
37
|
+
settle({ code: 127, stdout, stderr: error.message })
|
|
32
38
|
})
|
|
33
39
|
child.on('close', code => {
|
|
34
|
-
|
|
40
|
+
settle({ code: code ?? 1, stdout, stderr })
|
|
41
|
+
})
|
|
42
|
+
child.stdin.on('error', error => {
|
|
43
|
+
if (error?.code === 'EPIPE' || error?.code === 'ERR_STREAM_DESTROYED') return
|
|
44
|
+
stderr = stderr ? `${stderr}\n${error.message}` : error.message
|
|
35
45
|
})
|
|
36
46
|
child.stdin.end(input)
|
|
37
47
|
})
|
|
@@ -815,8 +825,6 @@ async function runCodex({ task, prompt, flags = {}, deps }) {
|
|
|
815
825
|
'-',
|
|
816
826
|
]
|
|
817
827
|
: [
|
|
818
|
-
'--ask-for-approval',
|
|
819
|
-
'never',
|
|
820
828
|
'--yolo',
|
|
821
829
|
'exec',
|
|
822
830
|
'--skip-git-repo-check',
|