zed
zed copied to clipboard
Use user's default shell in Zed's terminal
Context:
- I did some digging and found that Alacritty (which we forked) by default does not use the user's $SHELL, but instead uses what's specified in /etc/passwd if any. This PR starts it with $SHELL by default if $SHELL is set.
Release Notes:
- Fixed https://github.com/zed-industries/zed/issues/5320
We require contributors to sign our Contributor License Agreement, and we don't have @snokpok on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
Adding @mikayla-maki as a reviewer, as she is more familiar with the terminal code 😄
Aside: is /etc/passwd
even relevant on macOS? I think the actual source of truth is whatever it is the following command consults dscl . -read $HOME UserShell
Aside: is
/etc/passwd
even relevant on macOS? I think the actual source of truth is whatever it is the following command consultsdscl . -read $HOME UserShell
~~IIRC macOS uses /etc/master.passwd
for that stuff, which uses a different format, but an /etc/passwd
file is automatically generated for compatibility with programs that read /etc/passwd
~~
Nevermind, I think this is true for older versions but on my mac /etc/passwd
and /etc/master.passwd
contain default info, my user isn't even in there and root has a default shell of /bin/sh
instead of /bin/zsh
- I did some digging and found that Alacritty (which we forked) by default does not use the user's $SHELL, but instead uses what's specified in /etc/passwd if any. This PR starts it with $SHELL by default if $SHELL is set.
This code in alacritty tells me that they do check $SHELL
first:
https://github.com/alacritty/alacritty/blob/7c046f5ae664f746c5f5a4bbe18c0e89f5702305/alacritty_terminal/src/tty/unix.rs#L136-L158
I'm wondering whether the problem isn't that $SHELL
isn't set at this point yet?
Yeah, this PR isn't correct. I debugged this with a user several months ago and it turned out Zed wasn't loading the SHELL
environment variable somehow. The relevant code is in main.rs.