Skip to content

An uncaught exception makes the CLI exit with status 1 - #517

Merged
stevedekorte merged 1 commit into
masterfrom
cli-exit-status
Nov 18, 2026
Merged

stevedekorte merged 1 commit into
masterfrom
cli-exit-status

Conversation

@stevedekorte

Copy link
Copy Markdown
Member

A script or -e expression that ended with an uncaught exception exited 0, so shell scripts and CI couldn't tell it failed.

Cause: IoState_runCLI checked the current coroutine for an exception, but CLI run executes in its own try coroutine, so the exception was never there. The intent (exit non-zero) dates from 2009.

Fix: a new IoState_on_doCString_withLabel_exception_ returns the uncaught exception from the try coroutine. runCLI exits 1 when there is one, unless System exit already set a status.

Case Before After
script / -e raising, syntax error 0 1
System exit(3) 3 3
caught error, error inside an actor, error typed in the REPL 0 0

Tests: make check now checks both exit statuses; the check fails on master. Io suite on both builds, C suite and 30 Node tests pass. The benchmark scripts still exit 0, so the benchmark job is unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_011WETVfgtbJ5chDp7AeZUe9

IoState_runCLI looked for the exception on the current coroutine, but
"CLI run" executes in its own try coroutine, so it never saw one and a
failing script exited 0. IoState_on_doCString_withLabel_exception_ now
returns the uncaught exception from the try coroutine, and runCLI exits
1 when there is one (System exit keeps its own status).

make check now verifies both exit statuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011WETVfgtbJ5chDp7AeZUe9
@stevedekorte
stevedekorte merged commit f75f3bf into master Nov 18, 2026
1 check passed
@stevedekorte
stevedekorte deleted the cli-exit-status branch November 18, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant