diff --git a/src/libcalamares/ProcessJob.cpp b/src/libcalamares/ProcessJob.cpp index 7c9393b5e..583a44d27 100644 --- a/src/libcalamares/ProcessJob.cpp +++ b/src/libcalamares/ProcessJob.cpp @@ -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. diff --git a/src/libcalamares/ProcessJob.h b/src/libcalamares/ProcessJob.h index 7056095d5..808b65b9c 100644 --- a/src/libcalamares/ProcessJob.h +++ b/src/libcalamares/ProcessJob.h @@ -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; };