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
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;
......
......@@ -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();
......
......@@ -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;
QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
QByteArray newOutput = process.readAllStandardOutput();
if (progressDialog)
progressDialog->newBuildOutput(newOutput);
if (!newOutput.isEmpty()) {
if (progressDialog)
progressDialog->newBuildOutput(newOutput);
m_compileLog.append(newOutput);
m_compileLog.append(QString::fromLatin1(newOutput));
}
}
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