Add working directory to ProcessJob

This commit is contained in:
Teo Mrnjavac 2014-07-10 16:45:13 +02:00
parent 8d36a13d92
commit b3aae75bed
2 changed files with 11 additions and 2 deletions

View File

@ -23,9 +23,13 @@
namespace Calamares {
ProcessJob::ProcessJob( const QString& command, int secondsTimeout, QObject* parent )
ProcessJob::ProcessJob( const QString& command,
const QString& workingPath,
int secondsTimeout,
QObject* parent )
: Job( parent )
, m_command( command )
, m_workingPath( workingPath )
, m_timeoutSec( secondsTimeout )
{}
@ -47,6 +51,7 @@ ProcessJob::exec()
{
QProcess p;
p.setProcessChannelMode( QProcess::MergedChannels );
p.setWorkingDirectory( m_workingPath );
p.start( m_command );
// It's ok to block here because JobQueue runs this method in a separate thread.

View File

@ -27,7 +27,10 @@ class ProcessJob : public Job
{
Q_OBJECT
public:
explicit ProcessJob( const QString& command, int secondsTimeout, QObject* parent = nullptr );
explicit ProcessJob( const QString& command,
const QString& workingPath,
int secondsTimeout = 30,
QObject* parent = nullptr );
virtual ~ProcessJob();
QString prettyName() const override;
@ -35,6 +38,7 @@ public:
private:
QString m_command;
QString m_workingPath;
int m_timeoutSec;
};