is there a way to start/stop linux processes with python?

后端 未结 6 740
你的背包
你的背包 2021-01-05 02:31

I want to be able to start a process and then be able to kill it afterwards

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 02:56

    If you need to interact with the sub process at all, I recommend the pexpect module (link text). You can send input to the process, receive (or "expect") output in return, and you can close the process (with force=True to send SIGKILL).

提交回复
热议问题