Issue
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)
Solution
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.
Answered By - C137
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.