-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Tasks with active venv get source /path/to/activate
as stdin
#9374
Comments
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can. |
@yumasheta we are trying to see if we can get rid of @luabud This is an item that we have to discus with VSCode. We need a way to know if a terminal was started as a part of a task or if user created the terminal using the + button. This is so we know to use the right commands if the terminal has to be be activated. |
@karthiknadig I am not really familiar with conda. But I suppose, it uses the same |
@yumasheta Ah yes. Sorry. The problem is as i described in the second paragraph. We have no way to hook into when the terminal gets created to know when to activate. This usually means if VSCode gets to it first, then it runs the command first and we activate later. You may see this problem while debugging as well, the activation command sometimes occurs after the debugger command is executed. |
This issue should be resolved when we support #11039. This way we will not be sending the activate command to terminal at all. Closing this in favor of the above issue. |
Environment data
VS Code version:
Python Extension version: 2019.11.50794
Python version: 3.8.1
Type of virtual environment: venv
Expected behaviour
When configuring a task via the
.vscode/tasks.json
file and running it, the terminal used should change to the venv set and stdin should be empty for the commands in the task configuration to use (eg. when using read in a bash script).Actual behaviour
When running a task, (via command palette: 'Run Task') stdin is filled with the command:
source /path/to/activate
. If the command set in the task, reads from stdin, it gets this string.This only happens if the terminal window is fresh (previous terminals were killed). For repeated runs of the task in the same terminal (without setting
presentation{"panel":"new"}
), this behaviour is not observed.The command to load the venv (via source [...]/activate) should not be executed after the command from the task, but instead at the very beginning. It also should not fill up stdin.
When not having set a venv interpreter, the issue is not present.
Steps to reproduce:
zipped archive of the files and venv:
files.zip
./a.py
./b.sh
.vscode/tasks.json
Now use the command palette and run either task ('python' or 'bash').
When running the task in a fresh terminal, the output will be:
python:
bash:
For the bash version, there is also no environment variable $VIRTUAL_ENV set.
Remarks
I hope the explanations were clear enough.
I am very new to issue reporting. Please let me know, if I missed anything.
The text was updated successfully, but these errors were encountered: