GUI: Print and log messages when addon execution fails (#2408)
This adds an entry to the "Analysis Log" and prints a message via `qWarning()` when the execution of an addon fails because either the process failed to finish normally (for example if python binary is not found) or because the script has issues (for example because of an unhandled exception).
This commit is contained in:
parent
8d114a40e4
commit
95bbc7a1e2
|
@ -313,7 +313,22 @@ void CheckThread::runAddonsAndTools(const ImportProject::FileSettings *fileSetti
|
||||||
process.setProcessEnvironment(env);
|
process.setProcessEnvironment(env);
|
||||||
}
|
}
|
||||||
process.start(python, args);
|
process.start(python, args);
|
||||||
process.waitForFinished();
|
if (!process.waitForFinished()) {
|
||||||
|
const QString errMsg("ERROR: Process '" + python + " " + args.join(" ") +
|
||||||
|
"' did not finish successfully: " + process.errorString());
|
||||||
|
qWarning() << errMsg;
|
||||||
|
mResult.reportOut(errMsg.toStdString());
|
||||||
|
}
|
||||||
|
const QByteArray errout = process.readAllStandardError();
|
||||||
|
if (process.exitCode() != 0 && !errout.isEmpty()) {
|
||||||
|
const QString errMsg("ERROR: Process '" + python + " " + args.join(" ") +
|
||||||
|
"' failed with error code " +
|
||||||
|
QString::number(process.exitCode()) + ": '" +
|
||||||
|
process.errorString() +
|
||||||
|
"'\nError output: " + errout);
|
||||||
|
qWarning() << errMsg;
|
||||||
|
mResult.reportOut(errMsg.toStdString());
|
||||||
|
}
|
||||||
const QString output(process.readAllStandardOutput());
|
const QString output(process.readAllStandardOutput());
|
||||||
QFile f(dumpFile + '-' + addon + "-results");
|
QFile f(dumpFile + '-' + addon + "-results");
|
||||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (f.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
|
Loading…
Reference in New Issue