mirror of https://github.com/openspug/spug
U api update
parent
2d755ddcee
commit
e6873c7650
|
@ -209,7 +209,7 @@ class Helper:
|
|||
self.send_error('local', f'exit code: {task.returncode}')
|
||||
|
||||
def remote(self, key, ssh, command, env=None):
|
||||
command, code = 'set -e\n' + command, -1
|
||||
code = -1
|
||||
try:
|
||||
for code, out in ssh.exec_command_with_stream(command, environment=env):
|
||||
self.send_info(key, out)
|
||||
|
|
|
@ -53,6 +53,7 @@ class SSH:
|
|||
sftp.close()
|
||||
|
||||
def exec_command(self, command, timeout=1800, environment=None):
|
||||
command = 'set -e\n' + command
|
||||
with self as cli:
|
||||
chan = cli.get_transport().open_session()
|
||||
chan.settimeout(timeout)
|
||||
|
@ -65,6 +66,7 @@ class SSH:
|
|||
return chan.recv_exit_status(), out.read()
|
||||
|
||||
def exec_command_with_stream(self, command, timeout=1800, environment=None):
|
||||
command = 'set -e\n' + command
|
||||
with self as cli:
|
||||
chan = cli.get_transport().open_session()
|
||||
chan.settimeout(timeout)
|
||||
|
|
Loading…
Reference in New Issue