[Interest] QProcess::waitForStarted() returns false after timeout, then what?
René J. V. Bertin
rjvbertin at gmail.com
Sat Mar 11 15:30:44 CET 2017
Hello,
As far as I understand one doesn't have to call QProcess::waitForStarted() after
QProcess::start(); process will start (or not) regardless of whether that method
is called. Correct?
If so, what exactly does it mean if waitForStarted(x) returns false because of a
timeout error? Does that mean the process could still end up being ready, i.e.
could one do something like this?
job->start();
if (!job->waitForStarted(10) && job->error() == QProcess::Timedout)
qWarning() << "this isn't instantaneous";
if (!job->waitForStarted(600) && job->error() == QProcess::Timedout)
qWarning() << "maybe get some coffee";
if (!job->waitForStarted(aVeryLongTime) && job->error() == QProcess::Timedout)
qCritical() << "better call the underTaker!";
Or should any false return from waitForStarted() be taken as a definitive error
that won't be recovered from?
FWIW I have already seen crashes occur when a timeout error is handled as a hard
error (emitResult() called which apparently leads to deleting the QProcess
instance without disconnecting its slots first).
Thanks,
R.
More information about the Interest
mailing list