mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-13 15:44:56 +00:00
Fix run JSON output draining (#26955)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user