diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index c9db836642d2501ce7bef558c5b652b75b542e27..f19fe0d651a6e0055a8ea799e04dc16e344aa992 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -111,6 +111,8 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent) #ifdef Q_OS_UNIX d->m_consoleProcess.setSettings(Core::ICore::instance()->settings()); #endif + connect(&d->m_consoleProcess, SIGNAL(processStarted()), + this, SIGNAL(processStarted())); connect(&d->m_consoleProcess, SIGNAL(processError(QString)), this, SLOT(consoleProcessError(QString))); connect(&d->m_consoleProcess, SIGNAL(processStopped()), @@ -273,6 +275,7 @@ void ApplicationLauncher::processDone(int exitCode, QProcess::ExitStatus) void ApplicationLauncher::bringToForeground() { emit bringToForegroundRequested(applicationPID()); + emit processStarted(); } QString ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput() diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h index 257401c63f34b46f5f21d5e5dfd2b63ea396d445..cc36962b00553aaf9d190775cd14c46c52fec372 100644 --- a/src/plugins/projectexplorer/applicationlauncher.h +++ b/src/plugins/projectexplorer/applicationlauncher.h @@ -73,6 +73,7 @@ public: signals: void appendMessage(const QString &message, Utils::OutputFormat format); + void processStarted(); void processExited(int exitCode); void bringToForegroundRequested(qint64 pid); diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp index 2260c6e2b14ccdc7458372e6651030acfae75d2b..456069bf1cd0c0aa71e2cdb7c03323b4b36286d1 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp +++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp @@ -92,6 +92,8 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), 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(bringToForegroundRequested(qint64)), @@ -138,6 +140,12 @@ void LocalApplicationRunControl::slotAppendMessage(const QString &err, appendMessage(err, format); } +void LocalApplicationRunControl::processStarted() +{ + // Console processes only know their pid after being started + setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID())); +} + void LocalApplicationRunControl::processExited(int exitCode) { setApplicationProcessHandle(ProcessHandle()); diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.h b/src/plugins/projectexplorer/localapplicationruncontrol.h index e8a9f05ed73e8e18034f744ef36632bc3436288c..d0c793f232bcfca37525cb2c35af254be2051417 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.h +++ b/src/plugins/projectexplorer/localapplicationruncontrol.h @@ -64,6 +64,7 @@ public: virtual bool isRunning() const; virtual QIcon icon() const; private slots: + void processStarted(); void processExited(int exitCode); void slotAppendMessage(const QString &err, Utils::OutputFormat isError); private: