Skip to content

None exit code even after wait_finished() #424

Description

@ArthurGarnier

Describe the bug
After running a command with SSHClient.run_command(), then waiting with wait_finished(), the exit code is sometimes None

To Reproduce

Unfortulatly I'm not able to reproduce, it happens very rarely.
But this is how I tried to reproduce, which depict how I'm using the lib in real world :

import os
import getpass
from pssh.clients import SSHClient

_pass = getpass.getpass()

for i in range(200):
    print(f"Try {i}")
    client = SSHClient("lgwebsi1", user=os.getlogin(), password=_pass)
    command = "sudo -S curl --haproxy-protocol -sk -o /dev/null -w '%{http_code}' https://localhost/health"
    host_io = client.run_command(command)
    host_io.stdin.write(f"{_pass}\n")
    host_io.stdin.flush()
    client.wait_finished(host_io)
    returncode = host_io.exit_code
    if returncode is None:
        print("Failed")

This command is an example, it happens with various commands, and not always the same.

Expected behavior
Getting exit code

Actual behaviour
exit code is None

Screenshots
If applicable, add screenshots to help explain your problem.

Additional information
parallel-ssh 2.16.0.post1
ssh2-python 1.2.0.post1
Python 3.12.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions