Python subprocess: callback when cmd exits

后端 未结 7 1620
暗喜
暗喜 2020-11-28 21:36

I\'m currently launching a programme using subprocess.Popen(cmd, shell=TRUE)

I\'m fairly new to Python, but it \'feels\' like there ought to be some api

7条回答
  •  春和景丽
    2020-11-28 22:20

    There is also ProcesPoolExecutor since 3.2 in concurrent.futures (https://docs.python.org/3/library/concurrent.futures.html). The usage is as of the ThreadPoolExecutor mentioned above. With on exit callback being attached via executor.add_done_callback().

提交回复
热议问题