Add memeber-variable for exitCode of executed process.
This commit is contained in:
parent
86c996d7ac
commit
86064979b4
@ -8,7 +8,8 @@ Command::Command(QString const &command, int start_timeout, int finish_timeout)
|
|||||||
: m_command(command.trimmed())
|
: m_command(command.trimmed())
|
||||||
, m_commandResult("")
|
, m_commandResult("")
|
||||||
, m_waitForStartTimeout(start_timeout)
|
, m_waitForStartTimeout(start_timeout)
|
||||||
, m_waitForFinishTimeout(finish_timeout) {
|
, m_waitForFinishTimeout(finish_timeout)
|
||||||
|
, m_exitCode(-1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Command::getCommandResult() const {
|
QString Command::getCommandResult() const {
|
||||||
@ -62,7 +63,7 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
|||||||
if (p->waitForFinished(m_waitForFinishTimeout)) {
|
if (p->waitForFinished(m_waitForFinishTimeout)) {
|
||||||
//qDebug() << "PROCESS" << m_command << "FINISHED";
|
//qDebug() << "PROCESS" << m_command << "FINISHED";
|
||||||
if (p->exitStatus() == QProcess::NormalExit) {
|
if (p->exitStatus() == QProcess::NormalExit) {
|
||||||
if (p->exitCode() == 0) {
|
if ((m_exitCode = p->exitCode()) == 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "EXECUTED" << m_command << "with code" << p->exitCode();
|
qCritical() << "EXECUTED" << m_command << "with code" << p->exitCode();
|
||||||
|
@ -16,15 +16,17 @@ class Command : public QObject {
|
|||||||
QString m_commandResult;
|
QString m_commandResult;
|
||||||
int m_waitForStartTimeout;
|
int m_waitForStartTimeout;
|
||||||
int m_waitForFinishTimeout;
|
int m_waitForFinishTimeout;
|
||||||
|
int m_exitCode;
|
||||||
public:
|
public:
|
||||||
explicit Command(QString const &command,
|
explicit Command(QString const &command,
|
||||||
int start_timeout = 100000,
|
int start_timeout = 100000,
|
||||||
int finish_timeout = 100000);
|
int finish_timeout = 100000);
|
||||||
|
|
||||||
QString getCommandResult() const;
|
QString getCommandResult() const;
|
||||||
|
QString command() const { return m_command; }
|
||||||
|
|
||||||
bool execute(QString workingDirectory, QStringList args = QStringList());
|
bool execute(QString workingDirectory, QStringList args = QStringList());
|
||||||
|
int exitCode() const { return m_exitCode; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void readyReadStandardOutput();
|
void readyReadStandardOutput();
|
||||||
|
Loading…
Reference in New Issue
Block a user