我使用paramiko从远程Linux机器启动shell脚本.启动shell脚本并执行命令make -j8.但是exec_command在make完成之前返回.
如果我在本地计算机上启动脚本,它会正确执行.
有人能解释一下这种行为吗?
def*_*ode 26
您需要等待应用程序完成,exec_command不是阻塞调用.
print now(), "before call"
stdin, stdout, sterr = ssh.exec_command("sleep(10)")
print now(), "after call"
channel = stdout.channel
print now(), "before status"
status = channel.recv_exit_status()
print now(), "after status"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14079 次 |
| 最近记录: |