fix(hook): use tee-based capture instead of PTY proxy#14
Merged
Conversation
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
The previous fix (#13) tried to fix hook-induced terminal issues by tweaking the PTY proxy — that approach was wrong and broke colors. This PR takes the correct approach: eliminate the PTY proxy entirely for hooked sessions.
The hook (
eval "$(snag hook bash)") was usingexec snag wrapto interpose a PTY proxy between the terminal and the shell. This broke the terminal's direct relationship with the shell process, causing:~:bash(terminal couldn't track the shell's title/CWD)~(terminal couldn't read the shell's CWD via procfs or OSC 7)The fix: replace
exec snag wrap --capture <path>withexec > >(tee -a <path>) 2>&1— the same tee-based capture mechanism that adopted sessions already use. This keeps the shell as the terminal's direct child process, preserving all terminal integration (titles, CWD tracking, colors, VTE hooks).Also reverts all
cmd_wrapchanges from #13 (login shell, SHLVL, OSC 7 parsing, removed title) to restore its original behavior for direct usage.