Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote-cli code command works in bash, but zsh or tmux #7149

Open
samuela opened this issue Sep 2, 2022 · 2 comments
Open

remote-cli code command works in bash, but zsh or tmux #7149

samuela opened this issue Sep 2, 2022 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug cli remote Issues in the code server support
Milestone

Comments

@samuela
Copy link

samuela commented Sep 2, 2022

Version: 1.71.0 (Universal)
Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c
Date: 2022-09-01T07:25:38.437Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No

  • VSCode Version: 1.71.0 (Universal)
  • Local OS Version: Darwin arm64 21.6.0
  • Remote OS Version:
  • Remote Extension/Connection Type: SSH
  • Logs: n/a

Steps to Reproduce:

  1. Ensure that terminal.integrated.inheritEnv is set to true (the default).
  2. Connect to remote machine via VSCode SSH.
  3. Open a bash terminal. Run code. Observe that it works.
  4. Open a zsh terminal. (Select from the dropdown menu on the "+" button.) Run code. Observe that it fails.
  5. Try the same for tmux. Observe that it fails as well.

Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: Yes

It appears as though PATH is propagating correctly for bash, but not the other two:

# bash
my-machine:~$ echo $PATH
/home/sam.ainsworth/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/sam.ainsworth/.vscode-server/bin/784b0177c56c607789f9638da7b6bf3230d47a8c/bin/remote-cli:/home/sam.ainsworth/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/go/bin

# zsh
❯ echo $PATH
/home/sam.ainsworth/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/go/bin

# tmux
sam.ainsworth@cs-satze7x4cv-gpu-1662050665:~$ echo $PATH
/home/sam.ainsworth/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/go/bin

Opening a bash terminal and then running zsh from within that terminal works.

Why is VSCode propagating different environment variables to different shells?

Potentially related: #4460

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Sep 2, 2022
@roblourens roblourens removed the ssh Issue in vscode-remote SSH label Dec 6, 2022
@meganrogge meganrogge added remote Issues in the code server support cli bug Issue identified by VS Code Team member as probable bug labels Dec 6, 2022
@Tyriar
Copy link
Member

Tyriar commented Dec 6, 2022

It's not clear what's causing this to me, if bash works and zsh doesn't in the same session I'm guessing it's because zsh is replacing the path against out will?

@meganrogge meganrogge added this to the Backlog milestone Dec 6, 2022
@samuela
Copy link
Author

samuela commented Jan 12, 2023

FWIW I worked around this by adding

      export PATH="''${VSCODE_GIT_ASKPASS_NODE%/*}/bin/remote-cli:$PATH"

to programs.zsh.initExtra in my home-manager config.

Outside of a nix file (.zshrc, .zprofile, etc), you can probably get away without the escaping:

      export PATH="${VSCODE_GIT_ASKPASS_NODE%/*}/bin/remote-cli:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug cli remote Issues in the code server support
Projects
None yet
Development

No branches or pull requests

5 participants