Skip to content

Commit

Permalink
Merge pull request #6 from thebaptiste/metwork
Browse files Browse the repository at this point in the history
fix: in ssh_process, we exit(1) only if the exit code of the ssh command is not 0
  • Loading branch information
thuongnht authored Mar 5, 2021
2 parents 35fb71b + 5aa3c5e commit c9b539a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def ssh_process(ssh, input_ssh):

stdin, stdout, stderr = ssh.exec_command(command_str)

ssh_exit_status = stdout.channel.recv_exit_status()

out = "".join(stdout.readlines())
out = out.strip() if out is not None else None
if out:
Expand All @@ -105,6 +107,9 @@ def ssh_process(ssh, input_ssh):
err = err.strip() if err is not None else None
if err:
print(f"Error: \n{err}")

if ssh_exit_status != 0:
print(f"ssh exit status: {ssh_exit_status}")
sys.exit(1)

pass
Expand Down

0 comments on commit c9b539a

Please sign in to comment.