|
|
@@ -762,10 +762,15 @@ export const RunCommand = effectCmd({
|
|
|
|
|
|
if (!args.interactive) {
|
|
|
const events = await client.event.subscribe()
|
|
|
- loop(client, events).catch((e) => {
|
|
|
+ const completed = loop(client, events).catch((e) => {
|
|
|
console.error(e)
|
|
|
- process.exit(1)
|
|
|
+ process.exitCode = 1
|
|
|
})
|
|
|
+ async function finish() {
|
|
|
+ if (args.attach) return
|
|
|
+ const error = await completed
|
|
|
+ if (error) process.exitCode = 1
|
|
|
+ }
|
|
|
|
|
|
if (args.command) {
|
|
|
const result = await client.session.command({
|
|
|
@@ -779,7 +784,9 @@ export const RunCommand = effectCmd({
|
|
|
if (result.error) {
|
|
|
if (!emit("error", { error: result.error })) UI.error(formatRunError(result.error))
|
|
|
process.exitCode = 1
|
|
|
+ return
|
|
|
}
|
|
|
+ await finish()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -794,7 +801,9 @@ export const RunCommand = effectCmd({
|
|
|
if (result.error) {
|
|
|
if (!emit("error", { error: result.error })) UI.error(formatRunError(result.error))
|
|
|
process.exitCode = 1
|
|
|
+ return
|
|
|
}
|
|
|
+ await finish()
|
|
|
return
|
|
|
}
|
|
|
|