[libcalamares] Improve reporting of CalledProcessError

For called processes, replace the not-very-useful type message
with the command-explanation, and replace the value (previously
command-explanation) by the stderr of the failed command.

FIXES #865
This commit is contained in:
Adriaan de Groot 2017-11-28 11:38:26 -05:00
parent 9df796a3fd
commit cc195eb3d4

View File

@ -288,8 +288,18 @@ Helper::handleLastError()
bp::str outputString( a );
bp::extract< std::string > extractedOutput( outputString );
QString output;
if ( extractedOutput.check() )
valMsg.append( QString::fromStdString( extractedOutput() ) );
{
output = QString::fromStdString( extractedOutput() ).trimmed();
}
if ( !output.isEmpty() )
{
// Replace the Type of the error by the warning string,
// and use the output of the command (e.g. its stderr) as value.
typeMsg = valMsg;
valMsg = output;
}
}
debug << valMsg << '\n';
}
@ -323,7 +333,7 @@ Helper::handleLastError()
if ( !tbMsg.isEmpty() )
{
msgList.append( "Traceback:" );
msgList.append( QStringLiteral( "<br/>Traceback:" ) );
msgList.append( QString( "<pre>%1</pre>" ).arg( tbMsg.toHtmlEscaped() ) );
}