diff --git a/install.ps1 b/install.ps1 index 0c8efc97..7089ce20 100644 --- a/install.ps1 +++ b/install.ps1 @@ -8,7 +8,7 @@ param( $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" -$defaultInstallSha256 = "12b0c9b711955a664941529f4fef36a55799472d9788d43ab1988a15d31ce452" +$defaultInstallSha256 = "7e74935ae51bf8b0076f637bc640b33f0ca774bec065df56080a0321fa292820" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 75466031..81e5ea00 100644 --- a/install.py +++ b/install.py @@ -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): diff --git a/install.sh b/install.sh index 4629650c..8c631f09 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ esac TEMP_INSTALLER="" TEMP_DIRECTORY="" DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" -DEFAULT_INSTALL_SHA256="12b0c9b711955a664941529f4fef36a55799472d9788d43ab1988a15d31ce452" +DEFAULT_INSTALL_SHA256="7e74935ae51bf8b0076f637bc640b33f0ca774bec065df56080a0321fa292820" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install.py b/tests/test_install.py index 42ba8a55..5672ca15 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -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", "")