QmlDesigner: create error output file for puppet builds

Change-Id: I140820702d11e5bc20e6063bdee13411a5f2eeaa
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2015-07-09 10:25:54 +02:00
committed by Thomas Hartmann
parent 6eec39c308
commit 045d1496b5
3 changed files with 22 additions and 5 deletions

View File

@@ -67,6 +67,12 @@ bool PuppetBuildProgressDialog::useFallbackPuppet() const
return m_useFallbackPuppet;
}
void PuppetBuildProgressDialog::setErrorOutputFile(const QString &filePath)
{
ui->openErrorOutputFileLabel->setText(QString::fromLatin1("<a href='file:///%1'>%2</a>").arg(
filePath, ui->openErrorOutputFileLabel->text()));
}
void PuppetBuildProgressDialog::setUseFallbackPuppet()
{
m_useFallbackPuppet = true;

View File

@@ -51,6 +51,7 @@ public:
void setProgress(int progress);
void newBuildOutput(const QByteArray &standardOutput);
bool useFallbackPuppet() const;
void setErrorOutputFile(const QString &filePath);
private slots:
void setUseFallbackPuppet();

View File

@@ -391,21 +391,31 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath,
if (command.isEmpty())
return false;
const QString errorOutputFilePath(buildDirectoryPath + QLatin1String("/build_error_output.txt"));
if (QFile::exists(errorOutputFilePath))
QFile(errorOutputFilePath).remove();
progressDialog->setErrorOutputFile(errorOutputFilePath);
QProcess process;
process.setStandardErrorFile(errorOutputFilePath);
process.setProcessChannelMode(QProcess::SeparateChannels);
process.setProcessEnvironment(processEnvironment());
process.setWorkingDirectory(buildDirectoryPath);
process.start(command, processArguments);
process.waitForStarted();
while (process.waitForReadyRead(-1)) {
while (process.waitForReadyRead(100) || process.state() == QProcess::Running) {
if (progressDialog->useFallbackPuppet())
return false;
QByteArray newOutput = process.readAllStandardOutput();
if (progressDialog)
progressDialog->newBuildOutput(newOutput);
QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
m_compileLog.append(newOutput);
QByteArray newOutput = process.readAllStandardOutput();
if (!newOutput.isEmpty()) {
if (progressDialog)
progressDialog->newBuildOutput(newOutput);
m_compileLog.append(QString::fromLatin1(newOutput));
}
}
process.waitForFinished();