Repository navigation
Conversation
… script `echo $((1/0))` reported the error and then stopped the script: the failure reused the abort path `set -u` needs. It now ends only the enclosing subshell, as bash does, so the command fails with status 1 and the next one runs. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | c03e4b9 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 12:26 AM |
Contributor
Author
|
Closing as superseded: main now handles arithmetic failures through the line-abort path (#2604 and follow-ups), and this PR's new spec case ( Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
A failed
$(( ))now fails its own command and nothing more. It still ends anenclosing subshell, which is what bash does, but it no longer stops the script.
Why
Follow-up to #2604. Reporting arithmetic errors reused the abort path
set -uneeds, so the first division by zero silently truncated the run — the error was
printed and everything after it was skipped, with the script exiting 0.
Before / After
before, the error,rc=1,afterbefore, the error — nothing else ranA subshell still stops, as in bash:
gives
beforeandrc=1in both shells —neverdoes not run.Risk
Low. The failure carries
ControlFlow::Return(1)exactly as before, so everysubshell, function and
$( )boundary behaves as it did; one flag tells theoutermost script loop that this particular
Return(1)came from arithmetic andis not a reason to stop.
set -ustill ends the script.Checklist
cargo test -p bashkit --lib(2920 passed)cargo test -p bashkit --test integration(1368 passed)bash_comparisondifferential tests against real bashcargo clippy -p bashkit --all-targets -- -D warningscargo fmt --all --checkcargo test -p bashkit-cli(56 passed)just check-okflog.md)https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code