Add working directory to ProcessJob
This commit is contained in:
parent
8d36a13d92
commit
b3aae75bed
@ -23,9 +23,13 @@
|
|||||||
namespace Calamares {
|
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 )
|
: Job( parent )
|
||||||
, m_command( command )
|
, m_command( command )
|
||||||
|
, m_workingPath( workingPath )
|
||||||
, m_timeoutSec( secondsTimeout )
|
, m_timeoutSec( secondsTimeout )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -47,6 +51,7 @@ ProcessJob::exec()
|
|||||||
{
|
{
|
||||||
QProcess p;
|
QProcess p;
|
||||||
p.setProcessChannelMode( QProcess::MergedChannels );
|
p.setProcessChannelMode( QProcess::MergedChannels );
|
||||||
|
p.setWorkingDirectory( m_workingPath );
|
||||||
p.start( m_command );
|
p.start( m_command );
|
||||||
|
|
||||||
// It's ok to block here because JobQueue runs this method in a separate thread.
|
// It's ok to block here because JobQueue runs this method in a separate thread.
|
||||||
|
@ -27,7 +27,10 @@ class ProcessJob : public Job
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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();
|
virtual ~ProcessJob();
|
||||||
|
|
||||||
QString prettyName() const override;
|
QString prettyName() const override;
|
||||||
@ -35,6 +38,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_command;
|
QString m_command;
|
||||||
|
QString m_workingPath;
|
||||||
int m_timeoutSec;
|
int m_timeoutSec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user