microsoft / microsoft/vscode-remote-release

${execPath} has wrong value in a Container Remote

Open
#3,418 10 comments 0 reactions 1 assignee View on GitHub

@alexr00 is already working on this.

Since Jul 27, 2020.

containers feature-request plan-review variable-resolving
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1.47.2
  • Local OS Version: Ubuntu 20.04
  • Remote OS Version: Gentoo 4.15.0
  • Remote Extension/Connection Type: Docker using SSH remote host

Steps to Reproduce:

  1. Set "docker.host": "ssh://me@remote",
  2. Set "terminal.integrated.shellArgs.linux": ["--login"],
  3. Open a workspace I have set to /depot inside the remote container
  4. Create a task to open some file in VSCode
        {
            "label": "open gen.c",
            "type": "shell",
            "command": "${execPath} /depot/out/cur/gen/${fileBasenameNoExtension}.c",
            "problemMatcher": []
        },
  1. Run the task
> Executing task in folder depot: /snap/code/38/usr/share/code/code /depot/out/cur/gen/foo.c <

/bin/bash: /snap/code/38/usr/share/code/code: No such file or directory
The terminal process "/bin/bash '--login', '-c', '/snap/code/38/usr/share/code/code /depot/out/cur/gen/foo.c '" failed to launch (exit code: 127).

Wait a second, that's the path to code running on my local machine! In a remote context I would expect ${execPath} to resolve to the code instance running inside the container, thus allowing you to open the file in the current VSCode window:

(without --login)
user@user /depot $ which code
/home/user/.vscode-server/bin/<hash>/bin/code

Unfortunately I can't just use code because some of our tools need a login shell and the login profile clobbers the shell's PATH variable that VSCode normally adds itself to for this to work. I also have several /home/user/.vscode-server/bin/<hash> folders and looping over them seems bad.

I also can't use shell and automationShell differently since other tasks rely on the login shell as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.