Fix execution environment and error reporting in ProcessJob.
This commit is contained in:
parent
5b49521201
commit
b8b41bdfdd
@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,7 +48,9 @@ QString
|
|||||||
ProcessJob::prettyName() const
|
ProcessJob::prettyName() const
|
||||||
{
|
{
|
||||||
//TODO: show something more meaningful
|
//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();
|
output.clear();
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.setProgram( command );
|
process.setProgram( "/bin/sh" );
|
||||||
|
process.setArguments( { "-c", command } );
|
||||||
process.setProcessChannelMode( QProcess::MergedChannels );
|
process.setProcessChannelMode( QProcess::MergedChannels );
|
||||||
|
|
||||||
if ( !workingPath.isEmpty() )
|
if ( !workingPath.isEmpty() )
|
||||||
@ -122,9 +125,11 @@ ProcessJob::callOutput( const QString& command,
|
|||||||
if ( QDir( workingPath ).exists() )
|
if ( QDir( workingPath ).exists() )
|
||||||
process.setWorkingDirectory( QDir( workingPath ).absolutePath() );
|
process.setWorkingDirectory( QDir( workingPath ).absolutePath() );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cLog() << "Invalid working directory:" << workingPath;
|
cLog() << "Invalid working directory:" << workingPath;
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cLog() << "Running" << command;
|
cLog() << "Running" << command;
|
||||||
process.start();
|
process.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user