forked from qt-creator/qt-creator
Enable attaching to console processes
The pid is not immediately set for console processes. setApplicationHandle needs to be called in response to the ConsoleProcess::processStarted signal. Change-Id: I957d829936c33eff004f348a832d95f50b909016 Reviewed-on: http://codereview.qt.nokia.com/3491 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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()
|
||||
|
@@ -73,6 +73,7 @@ public:
|
||||
|
||||
signals:
|
||||
void appendMessage(const QString &message, Utils::OutputFormat format);
|
||||
void processStarted();
|
||||
void processExited(int exitCode);
|
||||
void bringToForegroundRequested(qint64 pid);
|
||||
|
||||
|
@@ -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());
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user