From b5c3fc8cf69274f326f5ba5d554f38f71019e9d2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 5 Apr 2018 04:51:51 -0400 Subject: [PATCH] [libcalamares] Improve process logging - Log output on crash - If debugging is on (-d) then also log output on success FIXES #925 --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 54243553a..ba0de827a 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -20,8 +20,9 @@ #include "CalamaresUtilsSystem.h" #include "utils/Logger.h" -#include "JobQueue.h" #include "GlobalStorage.h" +#include "JobQueue.h" +#include "Settings.h" #include #include @@ -173,7 +174,7 @@ System::runCommand( if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) ) { - cWarning() << "Timed out. output so far:\n" << + cWarning() << "Timed out. Output so far:\n" << process.readAllStandardOutput(); return -4; } @@ -182,13 +183,13 @@ System::runCommand( if ( process.exitStatus() == QProcess::CrashExit ) { - cWarning() << "Process crashed"; + cWarning() << "Process crashed. Output so far:\n" << output; return -1; } auto r = process.exitCode(); cDebug() << "Finished. Exit code:" << r; - if ( r != 0 ) + if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() ) { cDebug() << "Target cmd:" << args; cDebug().noquote() << "Target output:\n" << output;