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

+4 -1
View File
@@ -2812,7 +2812,10 @@ class WindowsSeenFromWsl(unittest.TestCase):
def test_the_windows_variables_are_read_through_cmd(self):
answers = {"USERPROFILE": "C:\\Users\\me", "APPDATA": "C:\\Users\\me\\AppData\\Roaming"}
def cmd(argv, **_kwargs):
def cmd(argv, **kwargs):
# cmd.exe must not read the terminal: it swallowed the answer
# typed at the first prompt.
self.assertIs(kwargs.get("stdin"), subprocess.DEVNULL)
name = argv[-1].split("%")[1]
return subprocess.CompletedProcess(argv, 0, answers.get(name, f"%{name}%") + "\r\n", "")