Add working directory to ProcessJob

main
Teo Mrnjavac 11 years ago
parent 8d36a13d92
commit b3aae75bed

@ -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.

@ -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;
};

Loading…
Cancel
Save