Get a signal once a subprocess ends

后端 未结 1 1453
隐瞒了意图╮
隐瞒了意图╮ 2021-01-28 18:16

I am using the subprocess.Popen function to run a command line. Without having to use Popen.wait(), I want to check the subprocess after it has finished using Popen.poll(). Any

相关标签:
1条回答
  • 2021-01-28 19:01

    As Python - wait on a condition without high cpu usage says, there are only two ways in existence to wait for something: polling or setting up/using a notification system.

    If it's UI - didn't you forget about one notification system you always have - the message queue?

    Besides, you can always (and, if it's UI, should always) perform any time-consuming tasks in worker threads. If which case, you are just fine with a synchronous call.

    0 讨论(0)
提交回复
热议问题