Long-running ssh commands in python paramiko module (and how to end them)

后端 未结 6 1777
野性不改
野性不改 2020-11-30 02:39

I want to run a tail -f logfile command on a remote machine using python\'s paramiko module. I\'ve been attempting it so far in the following fashion:

6条回答
  •  余生分开走
    2020-11-30 03:03

    To close the process simply run:

    interface.close()
    

    In terms of nonblocking, you can't get a non-blocking read. The best you would be able to to would be to parse over it one "block" at a time, "stdout.read(1)" will only block when there are no characters left in the buffer.

提交回复
热议问题