summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@digia.com>2013-08-01 17:38:49 +0200
committerDaniel Teske <daniel.teske@digia.com>2013-08-02 15:04:59 +0200
commitc1919f0ac30a224785d05c377f2193baee38cc1b (patch)
treea9094a9509ad546ec58886ab62ffbeaee117d40b
parent2654141511273c43548032a8901f71128184ec1b (diff)
downloadqt-creator-c1919f0ac30a224785d05c377f2193baee38cc1b.tar.gz
ApplicationLauncher: Also emit the exit status
And adjust the message in the appliation output to take the exit status into account. Change-Id: I1b7507fdc8ff6fa7ec3db48dba72ad723f124fc3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp4
-rw-r--r--src/plugins/projectexplorer/applicationlauncher.cpp10
-rw-r--r--src/plugins/projectexplorer/applicationlauncher.h2
-rw-r--r--src/plugins/projectexplorer/localapplicationruncontrol.cpp16
-rw-r--r--src/plugins/projectexplorer/localapplicationruncontrol.h2
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.cpp16
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp15
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectruncontrol.h2
9 files changed, 44 insertions, 25 deletions
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 11106768c5..70567f34e2 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -292,7 +292,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, DebuggerEng
connect(&m_applicationLauncher,
- SIGNAL(processExited(int)),
+ SIGNAL(processExited(int, QProcess::ExitStatus)),
SLOT(disconnected()));
connect(&m_applicationLauncher,
SIGNAL(appendMessage(QString,Utils::OutputFormat)),
@@ -597,7 +597,7 @@ void QmlEngine::startApplicationLauncher()
void QmlEngine::stopApplicationLauncher()
{
if (m_applicationLauncher.isRunning()) {
- disconnect(&m_applicationLauncher, SIGNAL(processExited(int)),
+ disconnect(&m_applicationLauncher, SIGNAL(processExited(int,QProcess::ExitStatus)),
this, SLOT(disconnected()));
m_applicationLauncher.stop();
}
diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp
index c0c920d068..0431ba0593 100644
--- a/src/plugins/projectexplorer/applicationlauncher.cpp
+++ b/src/plugins/projectexplorer/applicationlauncher.cpp
@@ -214,12 +214,14 @@ qint64 ApplicationLauncher::applicationPID() const
void ApplicationLauncher::guiProcessError()
{
QString error;
+ QProcess::ExitStatus status = QProcess::NormalExit;
switch (d->m_guiProcess.error()) {
case QProcess::FailedToStart:
error = tr("Failed to start program. Path or permissions wrong?");
break;
case QProcess::Crashed:
error = tr("The program has unexpectedly finished.");
+ status = QProcess::CrashExit;
break;
default:
error = tr("Some error has occurred while running the program.");
@@ -227,7 +229,7 @@ void ApplicationLauncher::guiProcessError()
emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat);
if (d->m_processRunning && !isRunning()) {
d->m_processRunning = false;
- emit processExited(-1);
+ emit processExited(-1, status);
}
}
@@ -236,7 +238,7 @@ void ApplicationLauncher::consoleProcessError(const QString &error)
emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat);
if (d->m_processRunning && d->m_consoleProcess.applicationPID() == 0) {
d->m_processRunning = false;
- emit processExited(-1);
+ emit processExited(-1, QProcess::NormalExit);
}
}
@@ -270,9 +272,9 @@ void ApplicationLauncher::checkDebugOutput(qint64 pid, const QString &message)
}
#endif
-void ApplicationLauncher::processDone(int exitCode, QProcess::ExitStatus)
+void ApplicationLauncher::processDone(int exitCode, QProcess::ExitStatus status)
{
- emit processExited(exitCode);
+ emit processExited(exitCode, status);
}
void ApplicationLauncher::bringToForeground()
diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h
index 4a8d8d7d01..3744bab624 100644
--- a/src/plugins/projectexplorer/applicationlauncher.h
+++ b/src/plugins/projectexplorer/applicationlauncher.h
@@ -71,7 +71,7 @@ public:
signals:
void appendMessage(const QString &message, Utils::OutputFormat format);
void processStarted();
- void processExited(int exitCode);
+ void processExited(int exitCode, QProcess::ExitStatus);
void bringToForegroundRequested(qint64 pid);
private slots:
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
index 2ff14ef297..ff19195f15 100644
--- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
@@ -84,8 +84,8 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig
this, SLOT(slotAppendMessage(QString,Utils::OutputFormat)));
connect(&m_applicationLauncher, SIGNAL(processStarted()),
this, SLOT(processStarted()));
- connect(&m_applicationLauncher, SIGNAL(processExited(int)),
- this, SLOT(processExited(int)));
+ connect(&m_applicationLauncher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(processExited(int,QProcess::ExitStatus)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
this, SLOT(bringApplicationToForeground(qint64)));
}
@@ -141,12 +141,18 @@ void LocalApplicationRunControl::processStarted()
setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID()));
}
-void LocalApplicationRunControl::processExited(int exitCode)
+void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatus status)
{
m_running = false;
setApplicationProcessHandle(ProcessHandle());
- QString msg = tr("%1 exited with code %2\n")
- .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
+ QString msg;
+ if (status == QProcess::CrashExit) {
+ msg = tr("%1 crashed\n")
+ .arg(QDir::toNativeSeparators(m_executable));
+ } else {
+ msg = tr("%1 exited with code %2\n")
+ .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
+ }
appendMessage(msg, Utils::NormalMessageFormat);
emit finished();
}
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.h b/src/plugins/projectexplorer/localapplicationruncontrol.h
index 0904f3d529..983de25766 100644
--- a/src/plugins/projectexplorer/localapplicationruncontrol.h
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.h
@@ -60,7 +60,7 @@ public:
virtual QIcon icon() const;
private slots:
void processStarted();
- void processExited(int exitCode);
+ void processExited(int exitCode, QProcess::ExitStatus status);
void slotAppendMessage(const QString &err, Utils::OutputFormat isError);
private:
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
index 9f246030e8..852ddd62a7 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
@@ -111,19 +111,25 @@ void LocalQmlProfilerRunner::start()
m_launcher.setWorkingDirectory(m_configuration.workingDirectory);
m_launcher.setEnvironment(m_configuration.environment);
- connect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int)));
+ connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(spontaneousStop(int,QProcess::ExitStatus)));
m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_configuration.executable,
arguments);
emit started();
}
-void LocalQmlProfilerRunner::spontaneousStop(int exitCode)
+void LocalQmlProfilerRunner::spontaneousStop(int exitCode, QProcess::ExitStatus status)
{
- if (QmlProfilerPlugin::debugOutput)
- qWarning("QmlProfiler: Application exited (exit code %d).", exitCode);
+ if (QmlProfilerPlugin::debugOutput) {
+ if (status == QProcess::CrashExit)
+ qWarning("QmlProfiler: Application crashed.");
+ else
+ qWarning("QmlProfiler: Application exited (exit code %d).", exitCode);
+ }
- disconnect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int)));
+ disconnect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(spontaneousStop(int,QProcess::ExitStatus)));
emit stopped();
}
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
index 70226f42bd..540f472241 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
@@ -68,7 +68,7 @@ public:
virtual quint16 debugPort() const;
private slots:
- void spontaneousStop(int exitCode);
+ void spontaneousStop(int exitCode, QProcess::ExitStatus status);
private:
LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine);
diff --git a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
index a6e555d882..27fb2a5952 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
@@ -71,8 +71,8 @@ QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfig
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
this, SLOT(slotAppendMessage(QString,Utils::OutputFormat)));
- connect(&m_applicationLauncher, SIGNAL(processExited(int)),
- this, SLOT(processExited(int)));
+ connect(&m_applicationLauncher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(processExited(int,QProcess::ExitStatus)));
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
this, SLOT(slotBringApplicationToForeground(qint64)));
}
@@ -119,10 +119,15 @@ void QmlProjectRunControl::slotAppendMessage(const QString &line, Utils::OutputF
appendMessage(line, format);
}
-void QmlProjectRunControl::processExited(int exitCode)
+void QmlProjectRunControl::processExited(int exitCode,QProcess::ExitStatus status)
{
- QString msg = tr("%1 exited with code %2\n")
- .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
+ QString msg;
+ if (status == QProcess::CrashExit)
+ msg = tr("%1 crashed\n") .arg(QDir::toNativeSeparators(m_executable));
+ else
+ msg = tr("%1 exited with code %2\n")
+ .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
+
appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat);
emit finished();
}
diff --git a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.h b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.h
index 9eea9736d5..6a041bd776 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.h
@@ -56,7 +56,7 @@ public:
QString mainQmlFile() const;
private slots:
- void processExited(int exitCode);
+ void processExited(int exitCode, QProcess::ExitStatus status);
void slotBringApplicationToForeground(qint64 pid);
void slotAppendMessage(const QString &line, Utils::OutputFormat);