开发者

Is there a way to pause a Python subprocess, specifically in Ubuntu?

I have a GUI based program where I need the user to be able to pause or resume a subprocess. For example, if I have:

开发者_运维技巧
programID = subprocess.Popen("program_name"), shell=True)

Is there a way that I can pause or resume this? I read something about using SIGTERM but I didn't quite grasp it.


To pause the process, use

os.kill(programID.pid, signal.SIGSTOP)

To resume execution, use

os.kill(programID.pid, signal.SIGCONT)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜