fix(webui): recognize missing Python from Windows sshd exit 1
This commit is contained in:
1 parent
b18ca98aff
commit
413b9a1074
2 files changed
+9
-3
No files matched your search
@@ -159,10 +159,14 @@ async def run_check(
|
||||
await stop_process(process)
|
||||
if process.returncode == 0:
|
||||
break
|
||||
# Missing command: POSIX 127, cmd.exe 9009 (truncated to 49
|
||||
# by POSIX SSH clients), or PowerShell's exception marker.
|
||||
# Windows sshd may report a missing command as 1. Match the
|
||||
# quoted executable in cmd.exe's diagnostic, not its language.
|
||||
first_line = stderr.partition(b"\n")[0]
|
||||
if not sudo and (process.returncode in {49, 127, 9009} or (
|
||||
process.returncode == 1 and b"CommandNotFoundException" in stderr
|
||||
process.returncode == 1 and (
|
||||
b"CommandNotFoundException" in stderr
|
||||
or any(f"{quote}{executable}{quote}".encode() in first_line for quote in ("'", '"'))
|
||||
)
|
||||
)):
|
||||
continue
|
||||
error = ssh_error(stderr)
|
||||
|
||||
@@ -1045,6 +1045,8 @@ async def test_probe_ignores_shell_banners_without_exposing_them(monkeypatch, ba
|
||||
@pytest.mark.parametrize(("returncode", "stderr", "expected_error"), [
|
||||
(127, b"python3: not found", ""),
|
||||
(49, b"'python3' is not recognized as an internal or external command", ""),
|
||||
(1, b"'python3' is not recognized as an internal or external command", ""),
|
||||
(1, '"python3" 不是内部或外部命令'.encode(), ""),
|
||||
(1, b"FullyQualifiedErrorId : CommandNotFoundException", ""),
|
||||
(255, b"Permission denied (publickey).", "ssh_auth_failed"),
|
||||
(1, b"Traceback (most recent call last):", "probe_failed"),
|
||||
|
||||
Reference in new issue
Block a user