Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.12.11, 6.2.1
-
None
-
macOS 11.5.1
Description
I'm trying to run bash script:
auto marker = QUuid::createUuid().toString(QUuid::WithoutBraces); marker.replace("-", ""); auto cmd = QString("echo -n %1${PATH}%1").arg(marker); auto args = QStringList() << "-l" << "-c" << cmd; QProcess *p = new QProcess; connect(...); p->start("/bin/bash", args);
The bug is that under the debugger finished signal is never emitted. I've tried to add 15 seconds timeout (using QTimer) with the following code:
onTimeout() { process->kill(); auto output = process->readAll(); process->waitForFinished(); }
QProcess::kill() does nothing actually. It still does not generate any events, QProces is still "running".
Output contains all the required output. I.e. all the expected output from the process is received already.
QProcess::waitForFinished does not return immediately and waits its 30 seconds interval.
I've tried to make a simple reproduce example and failed to do it. It does not reproduce inside of a simple app. It looks like some sort of race condition bug inside of QProcess, which requires some specific conditions to reproduce.
And, as I've stated already, the problem happens under running debugger only. I can't reproduce it if I just run my application.
Addition #1. Some more info discovered. If, some time later, I launch one yet process using QProcess (some console application), then, after I receive output from it, I also finally receive finished signal from my staled buggy QProcess. This is true for Qt5. Qt6 works worse. Please see comments.