sudo_askpass_proxy: check for stdin before print

This commit is contained in:
Jörg Thalheim
2025-08-25 13:59:43 +02:00
parent ab50b433ee
commit 03a4ac5bde

View File

@@ -83,10 +83,10 @@ class SudoAskpassProxy:
if line.startswith("PASSWORD_REQUESTED:"):
prompt = line[len("PASSWORD_REQUESTED:") :].strip()
password = self.handle_password_request(prompt)
print(password, file=ssh_process.stdin)
if ssh_process.stdin is None:
msg = "SSH process stdin is None"
raise ClanError(msg)
print(password, file=ssh_process.stdin)
ssh_process.stdin.flush()
else:
print(line)