ConsoleProcess: Show correct exit code

Task-number: QTCREATORBUG-9740

Change-Id: I41721356b3612b6c98e774168f520ff49426271b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Daniel Teske
2013-08-01 15:43:10 +02:00
parent 87507893e8
commit be112d853a
5 changed files with 9 additions and 15 deletions

View File

@@ -99,7 +99,7 @@ signals:
void processError(const QString &error); void processError(const QString &error);
// These reflect the state of the actual client process // These reflect the state of the actual client process
void processStarted(); void processStarted();
void processStopped(); void processStopped(int, QProcess::ExitStatus);
// These reflect the state of the console+stub // These reflect the state of the console+stub
void stubStarted(); void stubStarted();

View File

@@ -295,12 +295,12 @@ void ConsoleProcess::readStubOutput()
d->m_appStatus = QProcess::NormalExit; d->m_appStatus = QProcess::NormalExit;
d->m_appCode = out.mid(5).toInt(); d->m_appCode = out.mid(5).toInt();
d->m_appPid = 0; d->m_appPid = 0;
emit processStopped(); emit processStopped(d->m_appCode, d->m_appStatus);
} else if (out.startsWith("crash ")) { } else if (out.startsWith("crash ")) {
d->m_appStatus = QProcess::CrashExit; d->m_appStatus = QProcess::CrashExit;
d->m_appCode = out.mid(6).toInt(); d->m_appCode = out.mid(6).toInt();
d->m_appPid = 0; d->m_appPid = 0;
emit processStopped(); emit processStopped(d->m_appCode, d->m_appStatus);
} else { } else {
emit processError(msgUnexpectedOutput(out)); emit processError(msgUnexpectedOutput(out));
d->m_stubPid = 0; d->m_stubPid = 0;
@@ -323,7 +323,7 @@ void ConsoleProcess::stubExited()
d->m_appStatus = QProcess::CrashExit; d->m_appStatus = QProcess::CrashExit;
d->m_appCode = -1; d->m_appCode = -1;
d->m_appPid = 0; d->m_appPid = 0;
emit processStopped(); // Maybe it actually did not, but keep state consistent emit processStopped(d->m_appCode, d->m_appStatus); // Maybe it actually did not, but keep state consistent
} }
emit stubStopped(); emit stubStopped();
} }

View File

@@ -261,7 +261,7 @@ void ConsoleProcess::inferiorExited()
cleanupInferior(); cleanupInferior();
d->m_appStatus = QProcess::NormalExit; d->m_appStatus = QProcess::NormalExit;
d->m_appCode = chldStatus; d->m_appCode = chldStatus;
emit processStopped(); emit processStopped(d->m_appCode, d->m_appStatus);
} }
void ConsoleProcess::cleanupStub() void ConsoleProcess::cleanupStub()
@@ -288,7 +288,7 @@ void ConsoleProcess::stubExited()
cleanupInferior(); cleanupInferior();
d->m_appStatus = QProcess::CrashExit; d->m_appStatus = QProcess::CrashExit;
d->m_appCode = -1; d->m_appCode = -1;
emit processStopped(); emit processStopped(d->m_appCode, d->m_appStatus);
} }
emit stubStopped(); emit stubStopped();
} }

View File

@@ -113,8 +113,8 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
this, SIGNAL(processStarted())); this, SIGNAL(processStarted()));
connect(&d->m_consoleProcess, SIGNAL(processError(QString)), connect(&d->m_consoleProcess, SIGNAL(processError(QString)),
this, SLOT(consoleProcessError(QString))); this, SLOT(consoleProcessError(QString)));
connect(&d->m_consoleProcess, SIGNAL(processStopped()), connect(&d->m_consoleProcess, SIGNAL(processStopped(int,QProcess::ExitStatus)),
this, SLOT(processStopped())); this, SLOT(processDone(int,QProcess::ExitStatus)));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
connect(WinDebugInterface::instance(), SIGNAL(cannotRetrieveDebugOutput()), connect(WinDebugInterface::instance(), SIGNAL(cannotRetrieveDebugOutput()),
@@ -181,7 +181,7 @@ void ApplicationLauncher::stop()
} }
} else { } else {
d->m_consoleProcess.stop(); d->m_consoleProcess.stop();
processStopped(); processDone(0, QProcess::CrashExit);
} }
} }
@@ -270,11 +270,6 @@ void ApplicationLauncher::checkDebugOutput(qint64 pid, const QString &message)
} }
#endif #endif
void ApplicationLauncher::processStopped()
{
emit processExited(0);
}
void ApplicationLauncher::processDone(int exitCode, QProcess::ExitStatus) void ApplicationLauncher::processDone(int exitCode, QProcess::ExitStatus)
{ {
emit processExited(exitCode); emit processExited(exitCode);

View File

@@ -75,7 +75,6 @@ signals:
void bringToForegroundRequested(qint64 pid); void bringToForegroundRequested(qint64 pid);
private slots: private slots:
void processStopped();
void guiProcessError(); void guiProcessError();
void consoleProcessError(const QString &error); void consoleProcessError(const QString &error);
void readStandardOutput(); void readStandardOutput();