forked from qt-creator/qt-creator
runUic: Have a timeout on writing and error out if we can't write
Task-Number: QTCREATORBUG-6449 Change-Id: I592c7e925267d538124b96b899c1f8a6bc8d8955 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -148,18 +148,22 @@ bool UiCodeModelSupport::runUic(const QString &ui) const
|
||||
if (!process.waitForStarted())
|
||||
return false;
|
||||
process.write(ui.toUtf8());
|
||||
if (!process.waitForBytesWritten(3000))
|
||||
goto error;
|
||||
process.closeWriteChannel();
|
||||
if (process.waitForFinished() && process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) {
|
||||
m_contents = process.readAllStandardOutput();
|
||||
m_cacheTime = QDateTime::currentDateTime();
|
||||
if (debug)
|
||||
qDebug() << "ok" << m_contents.size() << "bytes.";
|
||||
return true;
|
||||
} else {
|
||||
if (debug)
|
||||
qDebug() << "failed" << process.readAllStandardError();
|
||||
process.kill();
|
||||
}
|
||||
if (!process.waitForFinished(3000) && process.exitStatus() != QProcess::NormalExit && process.exitCode() != 0)
|
||||
goto error;
|
||||
|
||||
m_contents = process.readAllStandardOutput();
|
||||
m_cacheTime = QDateTime::currentDateTime();
|
||||
if (debug)
|
||||
qDebug() << "ok" << m_contents.size() << "bytes.";
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (debug)
|
||||
qDebug() << "failed" << process.readAllStandardError();
|
||||
process.kill();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user