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
Startingstate appear for a very short time, invoid QProcessPrivate::startProcess(), set at begining, changed toRunning/NotRunningafterforkfd()( a wrapper offork()?) success /fail. TheQProcess::kill()member function I use to force kill process uses the pid returned fromforkfd(). So, whenprocess->state() == QProcess::Startingandkill()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?
-
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
Startingstate appear for a very short time, invoid QProcessPrivate::startProcess(), set at begining, changed toRunning/NotRunningafterforkfd()( a wrapper offork()?) success /fail. TheQProcess::kill()member function I use to force kill process uses the pid returned fromforkfd(). So, whenprocess->state() == QProcess::Startingandkill()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