From 1e27c6438ad73d50dedd60177531fc31fd7bb4fc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Nov 2017 11:21:42 -0500 Subject: [PATCH] [libcalamares] Special-case CalledProcessError --- src/libcalamares/PythonHelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp index 76f838a49..33e3b00d4 100644 --- a/src/libcalamares/PythonHelper.cpp +++ b/src/libcalamares/PythonHelper.cpp @@ -274,6 +274,19 @@ Helper::handleLastError() if ( valMsg.isEmpty() ) valMsg = tr( "unparseable Python error" ); + + // Special-case: CalledProcessError has an attribute "output" with the command output, + // add that to the printed message. + if ( typeMsg.contains( "CalledProcessError" ) ) + { + bp::object exceptionObject( h_val ); + auto a = exceptionObject.attr( "output" ); + bp::str outputString( a ); + bp::extract< std::string > extractedOutput( outputString ); + + if ( extractedOutput.check() ) + valMsg.append( QString::fromStdString( extractedOutput() ) ); + } } QString tbMsg;