microsoft / microsoft/vscode-remote-release

venv in a wsl remote terminal is not activated when .bash_aliases has a powershell command

Open
#4,040 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug wsl
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1,15.1
  • Local OS Version: Windows 10 20H2
  • Remote OS Version: Ubuntu 18.04
  • Remote Extension/Connection Type: WSL

Steps to Reproduce:

  1. Put the below in your .bash_aliases

    echo $(pwsh.exe -noprofile -c echo hi)

  2. Open a terminal in vscode when a editing some Python file - venv does not get activated. Looks like it's invoked before the terminal is ready. Here is the output in the terminal (note retailer is my venv name):

    source /home/uri/.virtualenvs/retailer/bin/activate
    hi
    uri@milky-way:~/git/retailer-adapter$

BTW, if my .bash_aliases file is

echo $(echo bye)

everything works well and this is the output I get:

bye
uri@milky-way:~/git/retailer-adapter$ source /home/uri/.virtualenvs/retailer/bin/activate
(retailer) uri@milky-way:~/git/retailer-adapter$ 

Also, to put things in context, note the steps to reproduce are a simplification of the actual use case. I need to set some environment variable from the output of a command only available in powershell.

export VAR=$(pwsh.exe -c ...)

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

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.

Research direction

Reproduce the issue using the .bash_aliases examples and a VS Code WSL terminal while editing a Python file. Compare the PowerShell command case with the nested echo case, then trace terminal startup and virtual-environment activation. Done means the venv is activated after shell initialization even when .bash_aliases runs a PowerShell command.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, powershell, python, ubuntu, vscode
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.