Merge pull request 'fix(shell): don't exec tmux during VS Code's shell-env probe' (#73) from fix/vscode-shell-env-tmux-guard into main
CI / flake (push) Successful in 3m37s
CI / flake (push) Successful in 3m37s
Reviewed-on: #73
This commit was merged in pull request #73.
This commit is contained in:
@@ -96,6 +96,15 @@ in
|
||||
# runs before oh-my-zsh/compinit so the exec replaces the shell before
|
||||
# that setup is wasted. Guards, each preventing a real breakage:
|
||||
# interactive only -> don't hijack scp / `ssh host cmd` / scripted shells
|
||||
# stdout is a tty -> VS Code (macOS) resolves the shell environment on
|
||||
# startup by running an interactive login shell with
|
||||
# stdout piped, no controlling terminal. Without this
|
||||
# guard `exec tmux` runs there, fails ("open terminal
|
||||
# failed: not a terminal"), exits non-zero, and VS
|
||||
# Code reports "Unable to resolve your shell
|
||||
# environment". A real terminal always has a tty here.
|
||||
# not VS Code env -> also skip VS Code's env-resolution probe explicitly,
|
||||
# in case a future version allocates a pty for it.
|
||||
# $TMUX empty -> a pane's zsh won't re-exec tmux (infinite loop)
|
||||
# not SSH -> don't force inbound SSH logins into a server tmux
|
||||
# not VS Code -> its integrated terminal manages itself
|
||||
@@ -103,6 +112,8 @@ in
|
||||
# $NO_TMUX unset -> escape hatch: `NO_TMUX=1 <term>` opens a bare shell
|
||||
(lib.mkOrder 200 ''
|
||||
if [[ $- == *i* ]] \
|
||||
&& [[ -t 1 ]] \
|
||||
&& [[ -z "$VSCODE_RESOLVING_ENVIRONMENT" ]] \
|
||||
&& [[ -z "$TMUX" ]] \
|
||||
&& [[ -z "$NO_TMUX" ]] \
|
||||
&& [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]] \
|
||||
|
||||
Reference in New Issue
Block a user