fix(bash): keep interactive commands from hanging the TUI#264
Merged
Conversation
An interactive command (an editor, ssh, a password/confirmation prompt) grabbed the parent TUI's controlling terminal and hung until timeout, and the foreground path then only killed bash — leaving the child that held the terminal alive past the deadline. - Start bash in a new session (setsid) so /dev/tty access fails fast instead of stealing the TUI's terminal; on timeout/cancel tear down the whole process group, with a WaitDelay backstop for inherited pipes - Nudge tools onto their non-interactive path via GIT_TERMINAL_PROMPT=0 and DEBIAN_FRONTEND=noninteractive - Steer the model: the Bash schema notes commands are non-interactive, and the timeout error suggests a non-interactive flag Signed-off-by: Meng Yan <yanmxa@gmail.com>
- A foreground command that backgrounds a child inheriting the output pipe (e.g. "./server &") exits 0, but the new WaitDelay then fires and Run returns ErrWaitDelay. Treat exit-0 + ErrWaitDelay as success instead of reporting a spurious failure. - os/exec keeps the last of duplicate env keys, so appending GIT_TERMINAL_PROMPT/DEBIAN_FRONTEND after os.Environ() overrode a value the user set, contrary to the comment. Set each only when unset. Signed-off-by: Meng Yan <yanmxa@gmail.com>
b23dde6 to
3f38349
Compare
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.
Interactive commands run by the Bash tool (an editor,
ssh, a password/confirmation prompt) grabbed the parent TUI's controlling terminal and hung until timeout — and the foreground path then only killedbash, leaving the child that held the terminal alive past the deadline.bashin a new session (setsid) so/dev/ttyaccess fails fast instead of stealing the TUI's terminal; on timeout/cancel tear down the whole process group, with aWaitDelaybackstop for inherited pipes. Foreground now matches the background path.GIT_TERMINAL_PROMPT=0andDEBIAN_FRONTEND=noninteractive.