Commit 045d1496 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Thomas Hartmann

QmlDesigner: create error output file for puppet builds

Change-Id: I140820702d11e5bc20e6063bdee13411a5f2eeaa
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 6eec39c3
...@@ -67,6 +67,12 @@ bool PuppetBuildProgressDialog::useFallbackPuppet() const ...@@ -67,6 +67,12 @@ bool PuppetBuildProgressDialog::useFallbackPuppet() const
return m_useFallbackPuppet; 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() void PuppetBuildProgressDialog::setUseFallbackPuppet()
{ {
m_useFallbackPuppet = true; m_useFallbackPuppet = true;
......
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
void setProgress(int progress); void setProgress(int progress);
void newBuildOutput(const QByteArray &standardOutput); void newBuildOutput(const QByteArray &standardOutput);
bool useFallbackPuppet() const; bool useFallbackPuppet() const;
void setErrorOutputFile(const QString &filePath);
private slots: private slots:
void setUseFallbackPuppet(); void setUseFallbackPuppet();
......
...@@ -391,21 +391,31 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, ...@@ -391,21 +391,31 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath,
if (command.isEmpty()) if (command.isEmpty())
return false; return false;
const QString errorOutputFilePath(buildDirectoryPath + QLatin1String("/build_error_output.txt"));
if (QFile::exists(errorOutputFilePath))
QFile(errorOutputFilePath).remove();
progressDialog->setErrorOutputFile(errorOutputFilePath);
QProcess process; QProcess process;
process.setStandardErrorFile(errorOutputFilePath);
process.setProcessChannelMode(QProcess::SeparateChannels); process.setProcessChannelMode(QProcess::SeparateChannels);
process.setProcessEnvironment(processEnvironment()); process.setProcessEnvironment(processEnvironment());
process.setWorkingDirectory(buildDirectoryPath); process.setWorkingDirectory(buildDirectoryPath);
process.start(command, processArguments); process.start(command, processArguments);
process.waitForStarted(); process.waitForStarted();
while (process.waitForReadyRead(-1)) { while (process.waitForReadyRead(100) || process.state() == QProcess::Running) {
if (progressDialog->useFallbackPuppet()) if (progressDialog->useFallbackPuppet())
return false; return false;
QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
QByteArray newOutput = process.readAllStandardOutput(); QByteArray newOutput = process.readAllStandardOutput();
if (progressDialog) if (!newOutput.isEmpty()) {
progressDialog->newBuildOutput(newOutput); if (progressDialog)
progressDialog->newBuildOutput(newOutput);
m_compileLog.append(newOutput); m_compileLog.append(QString::fromLatin1(newOutput));
}
} }
process.waitForFinished(); process.waitForFinished();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment