From cc195eb3d4dd24c8ec2b4133d2586e5d8eef89fe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Nov 2017 11:38:26 -0500 Subject: [PATCH] [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 --- src/libcalamares/PythonHelper.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp index 27100bada..11e199e0c 100644 --- a/src/libcalamares/PythonHelper.cpp +++ b/src/libcalamares/PythonHelper.cpp @@ -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( "
Traceback:" ) ); msgList.append( QString( "
%1
" ).arg( tbMsg.toHtmlEscaped() ) ); }