Skip to content

fix(cli): return non-zero exit code on uncaught runtime exceptions - #5465

Open
mmustafasenoglu wants to merge 2 commits into
boa-dev:mainfrom
mmustafasenoglu:fix/issue-4962-exitcode-upstream
Open

fix(cli): return non-zero exit code on uncaught runtime exceptions#5465
mmustafasenoglu wants to merge 2 commits into
boa-dev:mainfrom
mmustafasenoglu:fix/issue-4962-exitcode-upstream

Conversation

@mmustafasenoglu

Copy link
Copy Markdown
Contributor

Summary

Fixes the CLI exiting with code 0 when an uncaught runtime exception occurs. Syntax errors already returned non-zero; this extends the same behavior to runtime errors.

Changes

  • ****: Added after printing uncaught errors in (3 paths: job errors, evaluation errors, parsing errors) and (1 path).
  • ****: New integration tests verifying non-zero exit codes for stdin, -e expression, and file execution uncaught errors.

Before/After

127
127

Fixes #4962
Closes #4964 (supersedes stalled PR)

Previously, uncaught runtime exceptions (e.g. ReferenceError,
throw statements) were printed to stderr but the process still
exited with code 0. Syntax errors already returned non-zero.

Add error propagation via eyre::Result in evaluate_expr and
evaluate_file so that any uncaught error causes the CLI to
exit with a non-zero status code.

Also adds integration tests verifying non-zero exit codes for
stdin, -e expression, and file execution uncaught errors.

Fixes boa-dev#4962

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
@mmustafasenoglu
mmustafasenoglu requested a review from a team as a code owner July 29, 2026 10:48
@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Jul 29, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Jul 29, 2026
@github-actions github-actions Bot added C-CLI Issues and PRs related to the Boa command line interface. C-Tests Issues and PRs related to the tests. labels Jul 29, 2026
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Test262 conformance changes

Test result main count PR count difference
Total 53,125 53,125 0
Passed 51,073 51,073 0
Ignored 1,482 1,482 0
Failed 570 570 0
Panics 0 0 0
Conformance 96.14% 96.14% 0.00%

Tested main commit: 4fc75c6ae9d85f2b8065c6716f88e9b35318438c
Tested PR commit: c013f9248934eac0c8188a44de2e2f850934e801
Compare commits: 4fc75c6...c013f92

…rop lint

The MSRV and Lint CI jobs fail because `let _ = fs::remove_file(...)`
triggers the `let-underscore-drop` lint (implied by `-D warnings`).
Replace with an explicit `drop()` call which is the idiomatic way to
signal intentional discard of a Drop type.

Fixes CI for boa-dev#5465

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-CLI Issues and PRs related to the Boa command line interface. C-Tests Issues and PRs related to the tests. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

boa_cli exit code 0 on uncaught runtime exceptions

1 participant