Skip to content

The open source coding agent.

TypeScript

fix: exit code being non zero when using run cmd (#2523)

Aiden Clinefde03d3c93c2
diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts
index 7a234fc5882..acee1219428 100644
--- a/packages/opencode/src/cli/cmd/run.ts
+++ b/packages/opencode/src/cli/cmd/run.ts
@@ -71,7 +71,7 @@ export const RunCommand = cmd({
if (message.trim().length === 0 && !args.command) {
UI.error("You must provide a message or a command")
- return
+ process.exit(1)
}
await bootstrap(process.cwd(), async () => {
@@ -79,7 +79,7 @@ export const RunCommand = cmd({
const exists = await Command.get(args.command)
if (!exists) {
UI.error(`Command "${args.command}" not found`)
- return
+ process.exit(1)
}
}
const session = await (async () => {
@@ -104,7 +104,7 @@ export const RunCommand = cmd({
if (!session) {
UI.error("Session not found")
- return
+ process.exit(1)
}
const cfg = await Config.get()
@@ -221,6 +221,7 @@ export const RunCommand = cmd({
if (errorMsg) process.stdout.write(errorMsg)
}
UI.empty()
+ if (errorMsg) process.exit(1)
})
},
})