wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

`assume_shell = "Posix"` is broken with `fish` as a login shell

Open 9999years opened this issue 2 months ago • 0 comments

Related:

  • #7376

After noticing that it would be a 1-line patch to set assume_shell: Posix for wezterm ssh, I tried building WezTerm like that but found that this broke wezterm ssh entirely.

I think this is because WezTerm uses $SHELL -c ... as the ssh command, but a login shell for a POSIX box is not necessarily a POSIX shell:

$ ssh HOST env ... $SHELL -c '...; case "$SHELL" in */zsh|*/bash|*/ksh ) exec -a "-$(basename $SHELL)" $SHELL ;; esac ; exec $SHELL'
fish: "case" builtin not inside of switch block

Testing locally, I've found that replacing $SHELL -c with sh -c in mux/src/ssh.rs works correctly:

https://github.com/wezterm/wezterm/blob/118802c24420f3f4c206333cc7885cd922142e8e/mux/src/ssh.rs#L310

With that patch, wezterm ssh works correctly and is able to respect OSC 7, and sh is able to launch fish (my $SHELL correctly).

Is there a reason to not do this?

9999years avatar Nov 14 '25 21:11 9999years