Repository navigation
fix(script-driver): expose grouped-reader exit-jump verdict; exit --help continues (GNU CHECK_HELPOPT) - #1453
Merged
caomengxuan666 merged 1 commit intoOct 24, 2026
Conversation
…inue (niubash defects 2026-10-24) script_driver gains run_script_with_history_at_line_offset_tracked: the grouped reader's (status, exit_shell) verdict as a public result. The untracked wrapper already computed it and dropped the second half, which is exactly what left niubash's REPL prompting after `true; exit 3` had unwound (niubash R1). Same classification run_script_with_history_in_tracked documents: real exit/FatalFunctionError jump or errexit break, parse aborts excluded. exit --help now returns ExitAction::Continue(EX_USAGE) instead of Exit(EX_USAGE). GNU builtins/exit.def exit_builtin runs CHECK_HELPOPT first: the help prints and the builtin RETURNS EX_USAGE without jump_to_top_level (probe: bash -c 'exit --help; echo AFTER' prints AFTER; interactive `exit --help' keeps prompting). Only a parsed status word takes the EXITPROG path. part_041's two tests asserted the old jump and now assert ok + $?=2.
Contributor
Author
|
Companion host PR: unixwin/niubash#544 (fix/interactive-exit-jump-bubble) — records this engine verdict as session_exit_jump and ends the interactive REPL. Land together. |
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.
Summary
Two engine gaps that leave the interactive shell in the wrong state after a top-level
exit:;/&&/ alias-bearing lines) already computed the(status, exit_shell)verdict insidescript_driver, but the public wrapper threw the second half away. Callers (notably niubash's REPL) therefore never learned thattrue; exit 3had decided to leave the shell.exit --helpreturnedExitAction::Exit(EX_USAGE): it printed help and jumped to top level. GNUbuiltins/exit.defruns CHECK_HELPOPT first and returns EX_USAGE withoutjump_to_top_level(bash -c 'exit --help; echo AFTER'prints AFTER; interactiveexit --helpkeeps prompting). Without this, bubbling exit jumps would kill the session onexit --help(regression against niubash D1).Changes
script_driver: addrun_script_with_history_at_line_offset_trackedreturning the grouped reader's(status, exit_shell)verdict (exit/FatalFunctionError jump or errexit break; parse aborts excluded — same classificationrun_script_with_history_in_trackeddocuments). The untracked wrapper now delegates and keeps its old signature.builtins/exit:--helpreturnsContinue(EX_USAGE)instead of jumping; only a parsed status word takes the EXITPROG path.tests/executor_command_chaining/part_041.rs: the twoexit --helpassertions now expect continuation +$?=2(GNU form).Test plan
cargo test --test executor_tests exitbash -c 'exit --help; echo AFTER'(reference)true; exit 3/ alias / function end the session with the right rc;exit --helpkeeps promptingCompanion host PR: unixwin/niubash
fix/interactive-exit-jump-bubble(records the verdict assession_exit_jumpand ends the REPL). Follow-up to niubash defect log R1 (niubash-remaining-defects-2026-10-24).cherry-picked from local
d0006706.