Kill or terminate subprocess when timeout?

前端 未结 5 470
迷失自我
迷失自我 2020-12-01 02:24

I would like to repeatedly execute a subprocess as fast as possible. However, sometimes the process will take too long, so I want to kill it. I use signal.signal(...) like

5条回答
  •  一向
    一向 (楼主)
    2020-12-01 02:48

    A bit more complex, I added an answer to solve a similar problem: Capturing stdout, feeding stdin, and being able to terminate after some time of inactivity and/or after some overall runtime.

提交回复
热议问题