From b8b41bdfddec86149f7680417016e279fd6988ff Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 25 Feb 2015 13:44:55 +0100 Subject: [PATCH] Fix execution environment and error reporting in ProcessJob. --- src/libcalamares/ProcessJob.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/ProcessJob.cpp b/src/libcalamares/ProcessJob.cpp index a63af76bb..e46524acd 100644 --- a/src/libcalamares/ProcessJob.cpp +++ b/src/libcalamares/ProcessJob.cpp @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * Copyright 2014-2015, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +48,9 @@ QString ProcessJob::prettyName() const { //TODO: show something more meaningful - return tr( "Run command %1" ).arg( m_command ); + return tr( "Run command %1 %2" ) + .arg( m_command ) + .arg( m_runInChroot ? "in chroot" : "" ); } @@ -114,7 +116,8 @@ ProcessJob::callOutput( const QString& command, output.clear(); QProcess process; - process.setProgram( command ); + process.setProgram( "/bin/sh" ); + process.setArguments( { "-c", command } ); process.setProcessChannelMode( QProcess::MergedChannels ); if ( !workingPath.isEmpty() ) @@ -122,8 +125,10 @@ ProcessJob::callOutput( const QString& command, if ( QDir( workingPath ).exists() ) process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); else + { cLog() << "Invalid working directory:" << workingPath; return -3; + } } cLog() << "Running" << command;