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:
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QTemporaryFile>
|
||||
@@ -135,23 +136,23 @@ GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const
|
||||
args.append(QLatin1String("-c"));
|
||||
args.append(coreFile);
|
||||
|
||||
QProcess proc;
|
||||
SynchronousProcess proc;
|
||||
QStringList envLang = QProcess::systemEnvironment();
|
||||
Utils::Environment::setupEnglishOutput(&envLang);
|
||||
proc.setEnvironment(envLang);
|
||||
proc.start(debuggerCommand, args);
|
||||
SynchronousProcessResponse response = proc.run(debuggerCommand, args);
|
||||
|
||||
if (proc.waitForFinished()) {
|
||||
QByteArray ba = proc.readAllStandardOutput();
|
||||
if (response.result == SynchronousProcessResponse::Finished) {
|
||||
QString output = response.stdOut;
|
||||
// Core was generated by `/data/dev/creator-2.6/bin/qtcreator'.
|
||||
// Program terminated with signal 11, Segmentation fault.
|
||||
int pos1 = ba.indexOf("Core was generated by");
|
||||
int pos1 = output.indexOf("Core was generated by");
|
||||
if (pos1 != -1) {
|
||||
pos1 += 23;
|
||||
int pos2 = ba.indexOf('\'', pos1);
|
||||
int pos2 = output.indexOf('\'', pos1);
|
||||
if (pos2 != -1) {
|
||||
cinfo.isCore = true;
|
||||
cinfo.rawStringFromCore = QString::fromLocal8Bit(ba.mid(pos1, pos2 - pos1));
|
||||
cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1);
|
||||
cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user