Fix run JSON output draining (#26955)

This commit is contained in:
Kit Langton
2026-05-11 20:30:23 -04:00
committed by GitHub
parent fe374aea46
commit 061efc6cf2

View File

@@ -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
}