Repository navigation
fix(terminal): detect new bash commands by history number on bash 3.2 - #52
Merged
Merged
Conversation
macOS /bin/bash 3.2 keeps $HISTCMD at 1 inside PROMPT_COMMAND, so the hook never saw a new command and emitted no OSC 133;E marks. On bash < 4 read the number from `history 1` instead; newer bash keeps $HISTCMD (no extra fork per prompt under MSYS). bash 3.2 cannot mark seeded history lines as saved, so the e2e test only asserts they stay out of the history file on bash >= 4.
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.
What and why
mainCI failed on the macOS job after #51:bash_hook_end_to_endgot no OSC 133;E command marks. The macOS runner'sbashis/bin/bash3.2, where$HISTCMDstays at 1 insidePROMPT_COMMAND, so the hook's$HISTCMD != $__ember_hncheck never fired.history 1. Bash 4+ keeps$HISTCMD, so Git Bash pays no extra fork per prompt.history -a/-w/-n/-rvariants all tried), so there the restored lines are written back to the history file. The e2e test asserts "seeds stay out of the history file" only on bash >= 4. Only affects choosing/bin/bashon macOS (default shell there is zsh).[Unreleased]and does not claim macOS.Failing run: https://github.com/emberterm/emberterm/actions/runs/43879811129
How you checked it
CI runs only after a merge, so these are checked locally:
cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo testpass (111 passed)pnpm turbo check test build(181 Vitest tests passed) andpnpm version:checkpassbash_hook_end_to_endis the test that failed on macOS CI; I reproduced the missing marks with bash 3.2.57 in Docker and confirmed 4 marks on 3.2, 5.2 and 5.3 after the fixCHANGELOG.mdupdated if behaviour changed (not needed, see above)Local run was Windows (Git Bash 5.2) only; the macOS job runs after merge.