mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-10-08 08:02:12 +00:00
A pane configured to run fish still advertised the login shell, because pane_environment() injected TERM, the TTY7_* markers and TERM_PROGRAM but never touched SHELL -- so the pane inherited the GUI session's login-time snapshot of it. Everything that spawns "the user's shell" read that: tmux's default-shell started zsh inside a fish pane, and so did sudo -s, an editor's shell escape, and any coding agent picking a quoting dialect from $SHELL. The failure is silent -- fish rejects the bash line, the agent's sentinel file never appears, and the rejected text stays in the line editor to concatenate onto the next send. Inject SHELL alongside the other markers, set to the absolute path of the program the pane is about to exec. That program is read off argv rather than off the shell tty7 resolved: an argv-replacing integration injection and the parent-shell override both rewrite argv, while CommandBuilder::get_shell() keeps answering the passwd entry. Only an absolute path is ever written. A configured command may be bare (the inventory keeps it bare so PATH decides which install wins), and consumers exec $SHELL under a PATH of their own, so a bare name is resolved against the PATH the pane will inherit -- the user's env-block PATH when they set one -- and skipped when that finds nothing. A stale login shell beats a name that resolves somewhere else. An explicit SHELL in the user's env block still wins, the same precedence TERM_PROGRAM has: tty7 describes the pane, the user's config gets the last word. Windows is deliberately left out. Neither cmd nor PowerShell reads SHELL; the tools that do are the POSIX emulations (MSYS/Git Bash, Cygwin, WSL), and they want a POSIX path, not the Windows one this would have to give them. That also leaves the WSL pane alone, where the pane program is wsl.exe and the distro's own login shell is the right answer. Native SSH panes are unaffected: they never build a local command, and the remote sshd sets SHELL from the remote passwd entry. Closes #342 Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>