coder / code-server

VS Code in the browser
https://coder.com
MIT License
68.3k stars 5.6k forks source link

[Bug]: Terminal shows incorrect shell type after reloading webpage #6032

Open s3gfaultx opened 1 year ago

s3gfaultx commented 1 year ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. Set default shell to bash.
  2. Open terminal, should be bash.
  3. Click trashcan and kill the terminal.
  4. Refresh page, or close and re-open tab before reopening terminal.
  5. 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?

Are you accessing code-server over HTTPS?

Notes

No response

s3gfaultx commented 1 year ago

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.

code-asher commented 3 months ago

Any idea if this is still a problem with the latest version?

davidfirst commented 3 weeks ago

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.

Image

code-asher commented 2 weeks ago

Hmm yeah that does seem weird. We may need to dive into how VS Code chooses the shell.