Skip to content

fix(trap): propagate break/continue from ERR trap action to loop - #1439

Merged
arookieofc merged 1 commit into
masterfrom
fix-1405-break-in-err-trap
Oct 23, 2026
Merged

arookieofc merged 1 commit into
masterfrom
fix-1405-break-in-err-trap

Conversation

@arookieofc

Copy link
Copy Markdown
Member

Summary

break/continue in the ERR trap action now propagates to the enclosing loop, matching GNU.

Changes

  • src/executor/trap_exec.rs: maybe_run_error_trap_inner propagates Break/Continue unwinds (previously swallowed); preserves the failing command's status via break_failure_status.

Issues

Fixes #1405

Testing

  • New regression test: tests/issue1405_break_in_err_trap.rs (2 tests, all pass)
  • Verified: trap's break exits loop with rc=1, continue skips iterations

GNU honors break/continue in the ERR trap action, exiting/skipping the
enclosing loop. Rubash swallowed the unwind.

Fixes #1405
@arookieofc
arookieofc merged commit 966e10e into master Oct 23, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix-1405-break-in-err-trap branch October 30, 2026 01:41
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.

[bug] break/continue in ERR-trap action silently ignored inside loops (GNU honors it)

1 participant