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:
78
78
if sys .platform == "win32" :
79
79
if self ._name in ("powershell" , "pwsh" ):
80
80
args = ["-NoExit" , "-File" , str (activate_path )]
81
- else :
81
+ elif self . _name == "cmd" :
82
82
# /K will execute the bat file and
83
83
# keep the cmd process from terminating
84
84
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 )
87
97
88
98
import shlex
89
99
You can’t perform that action at this time.
0 commit comments