File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -78,12 +78,22 @@ def activate(self, env: VirtualEnv) -> int | None:
7878 if sys .platform == "win32" :
7979 if self ._name in ("powershell" , "pwsh" ):
8080 args = ["-NoExit" , "-File" , str (activate_path )]
81- else :
81+ elif self . _name == "cmd" :
8282 # /K will execute the bat file and
8383 # keep the cmd process from terminating
8484 args = ["/K" , str (activate_path )]
85- completed_proc = subprocess .run ([self .path , * args ])
86- return completed_proc .returncode
85+ else :
86+ args = None
87+
88+ if args :
89+ completed_proc = subprocess .run ([self .path , * args ])
90+ return completed_proc .returncode
91+ else :
92+ # If no args are set, execute the shell within the venv
93+ # This activates it, but there could be some features missing:
94+ # deactivate command might not work
95+ # shell prompt will not be modified.
96+ return env .execute (self ._path )
8797
8898 import shlex
8999
You can’t perform that action at this time.
0 commit comments