On Wednesday, 13 March 2019 14:08:19 PDT Jason H wrote: > In the situation that there's a problem, you end up waiting for timeout. > So: > connect(process,QOverload<int, > QProcess::ExitStatus>::of(&QProcess::finished), &loop, &QEventLoop::quit); > becomes: > connect(process, &QProcess::stateChanged,[=, &loop](QProcess::ProcessState > state) { qDebug() << "stateCanged" << state; > if (state == QProcess::ProcessState::NotRunning) loop.quit(); > }); > > Because the NotRunning will occur always, and immediately, and finished > won't. Failed command: > stateCanged QProcess::Starting > stateCanged QProcess::NotRunning > // no finished!
Good catch. A process that didn't start can't finish. Another way would be to waitForStarted() before entering the loop. Unlike the other waitFor functions, waitForStarted can be relied upon to finish rather quickly, since it only depends on the current thread anyway. If it takes long, then it's because the entire system is swapping hard and taking time to do everything. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel System Software Products _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest