Skip to content

Commit a555fc9

Browse files
committed
Use pipes directly, no pexpect on Windows
1 parent 1cb0cc5 commit a555fc9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

conda_spawn/shell.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,29 @@ def executable(self):
169169
return "shell"
170170

171171
def args(self):
172-
return ()
172+
return ("--interact", "--norc")
173+
174+
def spawn_popen(
175+
self, command: Iterable[str] | None = None, **kwargs
176+
) -> subprocess.Popen:
177+
try:
178+
with NamedTemporaryFile(
179+
prefix="conda-spawn-",
180+
suffix=self.Activator.script_extension,
181+
delete=False,
182+
mode="w",
183+
) as f:
184+
f.write(self.script())
185+
return subprocess.Popen(
186+
[self.executable(), *self.args(), f.name], env=self.env(), **kwargs
187+
)
188+
finally:
189+
self._files_to_remove.append(f.name)
190+
191+
def spawn(self, command: Iterable[str] | None = None) -> int:
192+
proc = self.spawn_popen(command)
193+
proc.communicate()
194+
return proc.wait()
173195

174196

175197
class CshShell(Shell):

0 commit comments

Comments
 (0)