@@ -106,7 +106,12 @@ def activate(self, env: VirtualEnv) -> int | None:
106
106
cmd = f"{ self ._get_source_command ()} { shlex .quote (str (activate_path ))} "
107
107
108
108
with env .temp_environ ():
109
- args = ["-e" , cmd ] if self ._name == "nu" else ["-i" ]
109
+ if self ._name == "nu" :
110
+ args = ["-e" , cmd ]
111
+ elif self ._name == "fish" :
112
+ args = ["-i" , "--init-command" , cmd ]
113
+ else :
114
+ args = ["-i" ]
110
115
111
116
c = pexpect .spawn (
112
117
self ._path , args , dimensions = (terminal .lines , terminal .columns )
@@ -120,14 +125,11 @@ def activate(self, env: VirtualEnv) -> int | None:
120
125
c .sendline (f"emulate bash -c '. { shlex .quote (str (activate_path ))} '" )
121
126
elif self ._name == "xonsh" :
122
127
c .sendline (f"vox activate { shlex .quote (str (env .path ))} " )
123
- elif self ._name == "nu" :
124
- # If this is nu, we don't want to send the activation command to the
128
+ elif self ._name in [ "nu" , "fish" ] :
129
+ # If this is nu or fish , we don't want to send the activation command to the
125
130
# command line since we already ran it via the shell's invocation.
126
131
pass
127
132
else :
128
- if self ._name in ["fish" ]:
129
- # Under fish, "\r" should be sent explicitly
130
- cmd += "\r "
131
133
c .sendline (cmd )
132
134
133
135
def resize (sig : Any , data : Any ) -> None :
0 commit comments