forked from qt-creator/qt-creator
Fix up QProcess::waitForFinished()
waitForFinish returns false if the process is no longer running at the time of the call. Handle that throughout the codebase. Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -129,16 +129,12 @@ QString BinaryVersionToolTipEventFilter::toolVersion(const QString &binary, cons
|
||||
{
|
||||
if (binary.isEmpty())
|
||||
return QString();
|
||||
QProcess proc;
|
||||
proc.start(binary, arguments);
|
||||
if (!proc.waitForStarted())
|
||||
SynchronousProcess proc;
|
||||
proc.setTimeoutS(1);
|
||||
SynchronousProcessResponse response = proc.run(binary, arguments);
|
||||
if (response.result != SynchronousProcessResponse::Finished)
|
||||
return QString();
|
||||
if (!proc.waitForFinished()) {
|
||||
SynchronousProcess::stopProcess(proc);
|
||||
return QString();
|
||||
}
|
||||
return QString::fromLocal8Bit(QByteArray(proc.readAllStandardOutput()
|
||||
+ proc.readAllStandardError()));
|
||||
return response.allOutput();
|
||||
}
|
||||
|
||||
// Extends BinaryVersionToolTipEventFilter to prepend the existing pathchooser
|
||||
|
||||
Reference in New Issue
Block a user