[Bug]: Terminal shows incorrect shell type after reloading webpage
Is there an existing issue for this?
- [X] I have searched the existing issues
OS/Web Information
- Web Browser: Chrome version 110.0.5481.178 (Official Build) (64-bit)
- Local OS: Windows 11 Pro
- Remote OS: Debian 11 in LXC
- Remote Architecture: x86 (AMD)
code-server --version: 4.10.0
Steps to Reproduce
- Set default shell to bash.
- Open terminal, should be bash.
- Click trashcan and kill the terminal.
- Refresh page, or close and re-open tab before reopening terminal.
- Hit CTRL+` to open terminal, will open sh terminal instead of bash -- hitting trashcan and reopening without the refresh it will open bash terminal as expected.
Expected
Expect that default terminal is launched regardless of state when the application was last used. If bash is set to default, it should launch a new bash terminal.
Actual
The wrong terminal is launched and the default setting is ignored.
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- [X] I cannot reproduce this in VS Code.
- [X] I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- [X] I am using HTTPS.
Notes
No response
I was able to fix this by adding the following line to my systemd service:
Environment="SHELL=/bin/bash"
I'm unsure why this was needed, since my user account is using bash and the SHELL environment is set correctly when I ssh into the hosting system. I'm not sure where it's coming from, but when the bug was triggered, I could echo $SHELL in the code terminal and it would be /bin/sh -- so somewhere it's being overridden.
Any idea if this is still a problem with the latest version?
Yes. Still happening. For us, only the first time the vscode is opened from the docker container. Afterwards, it always opens bash. In my extension, I open the terminal when the extension is activated, and this terminal is also "sh". I guess only after vscode is completely loaded it's able to open the default bash terminal. Not sure why.
Hmm yeah that does seem weird. We may need to dive into how VS Code chooses the shell.