Python code using the subprocess will generate a new process B
The purpose that is: at the same time close process and process B
QT code is as follows:
QProcess * my_process=new QProcess ();
My_process - & gt; Start (" python test_process. Py ");
Python code is as follows:
import subprocess
The import OS
Print (' parent pid, OS getpid ())
P=subprocess. Popen ([' python ', '- c', 'the import time; time. Sleep (100)'], shell=False)
Print (' child pid, p.p id)
P.w ait ()
Problem is: can pass in the QT my_process - & gt; ProcessId () to get that process A PID, then through the kill command to end it, but can't get the PID process B
Is there any way you can at the same time close process and process B (without the PID method can be)