mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-17 12:42:17 +00:00
Fix run JSON output draining (#26955)
This commit is contained in:
parent
fe374aea46
commit
061efc6cf2
1 changed files with 6 additions and 4 deletions
|
|
@ -719,6 +719,7 @@ export const RunCommand = effectCmd({
|
|||
}
|
||||
}
|
||||
}
|
||||
return error
|
||||
}
|
||||
const cwd = args.attach ? (directory ?? sess.directory ?? (await current(sdk))) : (directory ?? root)
|
||||
const client = args.attach ? attachSDK(cwd) : sdk
|
||||
|
|
@ -730,10 +731,7 @@ export const RunCommand = effectCmd({
|
|||
|
||||
if (!args.interactive) {
|
||||
const events = await client.event.subscribe()
|
||||
loop(client, events).catch((e) => {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
const completed = loop(client, events)
|
||||
|
||||
if (args.command) {
|
||||
await client.session.command({
|
||||
|
|
@ -744,6 +742,8 @@ export const RunCommand = effectCmd({
|
|||
arguments: message,
|
||||
variant: args.variant,
|
||||
})
|
||||
const error = await completed
|
||||
if (error) process.exitCode = 1
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -755,6 +755,8 @@ export const RunCommand = effectCmd({
|
|||
variant: args.variant,
|
||||
parts: [...files, { type: "text", text: message }],
|
||||
})
|
||||
const error = await completed
|
||||
if (error) process.exitCode = 1
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue