lib.ec.ssh.Paramiko: Avoid recv deadlock
_run_ssh() waits for the remote process's exit status before reading stdout and stderr. When a command produces more output than the channel's flow-control window can hold, the server stops sending, the remote process blocks on its write and never exits, and recv_exit_status() blocks forever. Drain stdout and stderr to EOF first - the channels close when the process exits, so reading them also implies completion - and only then query the exit status. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
28819d5f49
commit
d89afdc4a5
1 changed files with 3 additions and 1 deletions
|
|
@ -95,5 +95,7 @@ class Paramiko(Base):
|
|||
if cmd_input is not None:
|
||||
stdin.write(cmd_input)
|
||||
stdin.channel.shutdown_write()
|
||||
stdout_data = stdout.read()
|
||||
stderr_data = stderr.read()
|
||||
exit_status = stdout.channel.recv_exit_status()
|
||||
return Result(stdout.read(), stderr.read(), exit_status, cmd = cmd)
|
||||
return Result(stdout_data, stderr_data, exit_status, cmd = cmd)
|
||||
|
|
|
|||
Loading…
Reference in a new issue