mirror of
https://gitee.com/jack_whh/ssh-scp-ssh-pipelines.git
synced 2026-03-15 09:12:57 +08:00
Merge pull request #6 from thebaptiste/metwork
fix: in ssh_process, we exit(1) only if the exit code of the ssh command is not 0
This commit is contained in:
5
app.py
5
app.py
@@ -96,6 +96,8 @@ def ssh_process(ssh, input_ssh):
|
|||||||
|
|
||||||
stdin, stdout, stderr = ssh.exec_command(command_str)
|
stdin, stdout, stderr = ssh.exec_command(command_str)
|
||||||
|
|
||||||
|
ssh_exit_status = stdout.channel.recv_exit_status()
|
||||||
|
|
||||||
out = "".join(stdout.readlines())
|
out = "".join(stdout.readlines())
|
||||||
out = out.strip() if out is not None else None
|
out = out.strip() if out is not None else None
|
||||||
if out:
|
if out:
|
||||||
@@ -105,6 +107,9 @@ def ssh_process(ssh, input_ssh):
|
|||||||
err = err.strip() if err is not None else None
|
err = err.strip() if err is not None else None
|
||||||
if err:
|
if err:
|
||||||
print(f"Error: \n{err}")
|
print(f"Error: \n{err}")
|
||||||
|
|
||||||
|
if ssh_exit_status != 0:
|
||||||
|
print(f"ssh exit status: {ssh_exit_status}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user