Solved How to force kill a QProcess instance when it's state() is Starting.
-
When I try to force kill a QProcess instance, how should I deal with the case
process->state() == QProcess::Starting
?I checked the Qt source code, the
Starting
state appear for a very short time, invoid QProcessPrivate::startProcess()
, set at begining, changed toRunning
/NotRunning
afterforkfd()
( a wrapper offork()
?) success /fail. TheQProcess::kill()
member function I use to force kill process uses the pid returned fromforkfd()
. So, whenprocess->state() == QProcess::Starting
andkill()
is called, whether the child-process pid is there is not certain.Should I wait for the process started? What's the elegant way to force kill a QProcess instance?
-
@Gerald-L said in How to force kill a QProcess instance when it's state() is Starting.:
Should I wait for the process started?
I would do it like this, yes