diff --git a/process/command.cpp b/process/command.cpp index bfb1580..25efb3f 100644 --- a/process/command.cpp +++ b/process/command.cpp @@ -38,15 +38,21 @@ void Command::finished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/) { disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError())); } -bool Command::execute(QString workingDirectory) { +bool Command::execute(QString workingDirectory, QStringList args) { QScopedPointer p(new QProcess(this)); p->setProcessChannelMode(QProcess::MergedChannels); connect(&(*p), SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput())); connect(&(*p), SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError())); + qCritical() << "START COMMAND" << m_command << "IN" << workingDirectory; + p->setWorkingDirectory(workingDirectory); - p->start(m_command); + if (!args.isEmpty()) { + p->start(m_command, args); + } else { + p->start(m_command); + } if (p->waitForStarted(m_waitForStartTimeout)) { if (p->state() == QProcess::ProcessState::Running) { diff --git a/process/command.h b/process/command.h index 9ab0f09..6b79543 100644 --- a/process/command.h +++ b/process/command.h @@ -24,7 +24,7 @@ public: QString getCommandResult() const; - bool execute(QString workingDirectory = QCoreApplication::applicationDirPath()); + bool execute(QString workingDirectory, QStringList args = QStringList()); private slots: void readyReadStandardOutput();