From f9b1612fa701a29dfa286fde9c66df5e9fc14aa1 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 24 Aug 2011 14:49:50 +0200 Subject: [PATCH] Fix oddities on failing to run a local process Task-number: QTCREATORBUG-5758 Change-Id: I82268936a107ba83892f06a7d2658a2a32980b85 Reviewed-on: http://codereview.qt.nokia.com/3504 Reviewed-by: Qt Sanity Bot Reviewed-by: Oswald Buddenhagen --- src/plugins/projectexplorer/applicationlauncher.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index f19fe0d651a..4fc271cb7f0 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -81,6 +81,8 @@ struct ApplicationLauncherPrivate { QTextCodec *m_outputCodec; QTextCodec::ConverterState m_outputCodecState; QTextCodec::ConverterState m_errorCodecState; + // Keep track whether we need to emit a finished signal + bool m_processRunning; }; ApplicationLauncherPrivate::ApplicationLauncherPrivate() : @@ -155,6 +157,7 @@ void ApplicationLauncher::setEnvironment(const Utils::Environment &env) void ApplicationLauncher::start(Mode mode, const QString &program, const QString &args) { + d->m_processRunning = true; #ifdef Q_OS_WIN if (!WinDebugInterface::instance()->isRunning()) WinDebugInterface::instance()->start(); // Try to start listener again... @@ -225,11 +228,19 @@ void ApplicationLauncher::guiProcessError() error = tr("Some error has occurred while running the program."); } emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat); + if (d->m_processRunning && !isRunning()) { + d->m_processRunning = false; + emit processExited(-1); + } } 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); + } } void ApplicationLauncher::readStandardOutput()