Skip to content
Snippets Groups Projects
Commit 79481474 authored by ck's avatar ck
Browse files

Maemo: Better error handling for packaging commands.

parent 48d93e2f
No related branches found
No related tags found
No related merge requests found
...@@ -226,16 +226,24 @@ bool MaemoPackageCreationStep::runCommand(QProcess &proc, const QString &command ...@@ -226,16 +226,24 @@ bool MaemoPackageCreationStep::runCommand(QProcess &proc, const QString &command
perl = maddeRoot() + QLatin1String("/bin/perl.exe "); perl = maddeRoot() + QLatin1String("/bin/perl.exe ");
#endif #endif
proc.start(perl + maddeRoot() % QLatin1String("/madbin/") % command); proc.start(perl + maddeRoot() % QLatin1String("/madbin/") % command);
if (!proc.waitForStarted()) {
raiseError(tr("Packaging failed."),
tr("Packaging error: Could not start command '%1'. Reason: %2")
.arg(command).arg(proc.errorString()));
return false;
}
proc.write("\n"); // For dh_make proc.write("\n"); // For dh_make
if (!proc.waitForFinished(100000) && proc.error() == QProcess::Timedout) { if (!proc.waitForFinished(60000) && proc.error() == QProcess::Timedout) {
raiseError(tr("Packaging failed."), raiseError(tr("Packaging failed."),
tr("Packaging Error: Command '%1' timed out.").arg(command)); tr("Packaging Error: Command '%1' timed out.").arg(command));
return false; return false;
} }
if (proc.exitCode() != 0) { if (proc.error() != QProcess::UnknownError || proc.exitCode() != 0) {
const QString mainMessage = tr("Packaging Error: Command '%1' failed.") QString mainMessage = tr("Packaging Error: Command '%1' failed.")
.arg(command); .arg(command);
raiseError(mainMessage, mainMessage + QLatin1Char(' ') if (proc.error() != QProcess::UnknownError)
mainMessage += tr(" Reason: %1").arg(proc.errorString());
raiseError(mainMessage, mainMessage + QLatin1Char('\n')
+ tr("Output was: ") + proc.readAllStandardError() + tr("Output was: ") + proc.readAllStandardError()
+ QLatin1Char('\n') + proc.readAllStandardOutput()); + QLatin1Char('\n') + proc.readAllStandardOutput());
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment