I cannot understand why the program is returning starting state value which is 1 even after killing it.
Before starting it, it gives 0 value which is NotRunning and after starting it it gives 1.
What am I doing wrong here?
self.p = QProcess()
print("before start state: ", self.p.state())
self.p.start("python", ['run.py'])
print("after start state: ", self.p.state())
self.p.kill()
p = self.p.state()
print("after kill state: ", p)
Because the QProcess
doesn't start/finish immediately after calling start/kill
, you should connect to Qprocess::started()
and Qprocess::finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit)
signals.