forked from qt-creator/qt-creator
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 <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
committed by
Oswald Buddenhagen
parent
38d84d5b6a
commit
f9b1612fa7
@@ -81,6 +81,8 @@ struct ApplicationLauncherPrivate {
|
|||||||
QTextCodec *m_outputCodec;
|
QTextCodec *m_outputCodec;
|
||||||
QTextCodec::ConverterState m_outputCodecState;
|
QTextCodec::ConverterState m_outputCodecState;
|
||||||
QTextCodec::ConverterState m_errorCodecState;
|
QTextCodec::ConverterState m_errorCodecState;
|
||||||
|
// Keep track whether we need to emit a finished signal
|
||||||
|
bool m_processRunning;
|
||||||
};
|
};
|
||||||
|
|
||||||
ApplicationLauncherPrivate::ApplicationLauncherPrivate() :
|
ApplicationLauncherPrivate::ApplicationLauncherPrivate() :
|
||||||
@@ -155,6 +157,7 @@ void ApplicationLauncher::setEnvironment(const Utils::Environment &env)
|
|||||||
|
|
||||||
void ApplicationLauncher::start(Mode mode, const QString &program, const QString &args)
|
void ApplicationLauncher::start(Mode mode, const QString &program, const QString &args)
|
||||||
{
|
{
|
||||||
|
d->m_processRunning = true;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (!WinDebugInterface::instance()->isRunning())
|
if (!WinDebugInterface::instance()->isRunning())
|
||||||
WinDebugInterface::instance()->start(); // Try to start listener again...
|
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.");
|
error = tr("Some error has occurred while running the program.");
|
||||||
}
|
}
|
||||||
emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
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)
|
void ApplicationLauncher::consoleProcessError(const QString &error)
|
||||||
{
|
{
|
||||||
emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
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()
|
void ApplicationLauncher::readStandardOutput()
|
||||||
|
Reference in New Issue
Block a user