From 7be33b8196758c72c023a77f30ce335e4d96b5d2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 15:53:27 +0200 Subject: [PATCH] [libcalamares] runCommand doesn't need queue or settings - JobQueue is only needed to get global settings, which are needed when running in the target; for host commands, allow running without a queue. - Settings is needed for the value of debugsettings; assume if there's no settings object, that we're in a test and should print debugging information. --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 739249cd0..e2c6e9dec 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -156,13 +156,8 @@ System::runCommand( { QString output; - if ( !Calamares::JobQueue::instance() ) - { - cError() << "No JobQueue"; - return ProcessResult::Code::NoWorkingDirectory; - } + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); if ( ( location == System::RunLocation::RunInTarget ) && ( !gs || !gs->contains( "rootMountPoint" ) ) ) { @@ -239,7 +234,8 @@ System::runCommand( auto r = process.exitCode(); cDebug() << "Finished. Exit code:" << r; - if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() ) + bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() ); + if ( ( r != 0 ) || showDebug ) { cDebug() << "Target cmd:" << RedactedList( args ); cDebug().noquote().nospace() << "Target output:\n" << output;