paramiko SSH exec_command(shell script) returns before completion

前端 未结 1 571
耶瑟儿~
耶瑟儿~ 2020-12-29 07:34

I launch a shell script from a remote Linux machine using paramiko. The shell script is launched and execute a command make -j8. However the exec_command returns before the

相关标签:
1条回答
  • 2020-12-29 08:06

    You need to wait for application to finish, exec_command isn't a blocking call.

    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"
    
    0 讨论(0)
提交回复
热议问题