A api update

pull/22/head
雷二猛 2019-12-18 21:19:29 +08:00
parent d5b609cd12
commit 142965cfd6
1 changed files with 4 additions and 2 deletions

View File

@ -52,7 +52,8 @@ class SSH:
chan.settimeout(timeout)
chan.set_combine_stderr(True)
if environment:
chan.update_environment(environment)
str_env = ' '.join(f'{k}={v}' for k, v in environment.items())
command = f'export {str_env} && {command}'
chan.exec_command(command)
out = chan.makefile("r", -1)
return chan.recv_exit_status(), out.read()
@ -63,7 +64,8 @@ class SSH:
chan.settimeout(timeout)
chan.set_combine_stderr(True)
if environment:
chan.update_environment(environment)
str_env = ' '.join(f'{k}={v}' for k, v in environment.items())
command = f'export {str_env} && {command}'
chan.exec_command(command)
stdout = chan.makefile("r", -1)
out = stdout.readline()