fix: keep cmd.exe off the terminal under WSL

Reading the Windows variables through cmd.exe let it consume the answer typed at the first prompt: a WSL run exited 0 with nothing installed.
This commit is contained in:
Abdessamad Derraz committed 2026-10-19 05:15:52 +02:00
1 parent 3bb178bb74
commit f19dcba545
4 files changed
+9 -4

No files matched your search

+3 -1
View File
@@ -467,9 +467,11 @@ def _enter_wsl() -> None:
if os.environ.get(variable):
continue
try:
# No stdin: cmd.exe inherited the terminal and swallowed the
# answer typed at the first prompt.
result = subprocess.run(
["cmd.exe", "/c", f"echo %{variable}%"],
capture_output=True, text=True, timeout=10,
capture_output=True, text=True, timeout=10, stdin=subprocess.DEVNULL,
cwd="/mnt/c" if Path("/mnt/c").is_dir() else None,
)
except (OSError, subprocess.SubprocessError):