-
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
deactivate creates a new shell #22818
Comments
I understand the limitation here since you prefer not to instruct the user to modify ~/.bashrc neither you can add a function to the shell environment, but I'd prefer to source a handy script like in
|
Hi @memeplex , you're spot on with your observations. Creating a new subshell is required to support "deactivate" command in-box without needing for users modify their init file. In your case if you would prefer us not launching a new shell, you can follow the instructions here to set up the deactivate command for your shell: https://github.com/microsoft/vscode-python/wiki/Fixing-%22deactivate%22-command-for-Virtual-Environments. This would set up a "deactivate" shell hook, which would be run before our own deactivate script is run, thereby solving your issue. |
Wouldn't it be desirable to at least show some warning like "You're now in a subshell, press Ctrl-D to return to your previous environment", maybe linking to the wiki page you've mentioned? It doesn't feel right to throw the user into a new environment without notice. |
Based on majority use cases with command and the fact that number of users who actually use it are quite few, for now we're focusing on making the experience seamless. But that's good feedback, and we can decide to do that iteratively based on user reports. The environment variables though as I believe should still get carried over. |
Unfortunately, that's not the case except for exported variables. That's why I'm suggesting to be more explicit. Changing shells like this may be dangerous, removing variables and functions from the environment or, worst, changing/reverting their values. Personally, I believe it's not worth the little convenience of having |
Type: Bug
Behaviour
Expected vs. Actual
After the changes described in #22448,
deactivate
is creating a new shell. This shouldn't be the case given that, at least, it implies:Steps to reproduce:
echo $$
-> PID Xdeactivate
echo $$
-> PID YC-d
to exitecho $$
-> PID X againC-d
to exit (now the terminal is actually closed)Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.22.1
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:11.430Z)
OS version: Darwin arm64 23.3.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: