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