forked from qt-creator/qt-creator
ConsoleProcess: Uniform the common interface of QtcProcess
This is a preliminary step before merging ConsoleProcess into QtcProcess. Rename applicationPID() to processId(). Change-Id: I1f9a28e768505c08c2ca3529c2ff0432f2a62c78 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -138,7 +138,7 @@ public:
|
||||
ConsoleProcess::Mode m_mode = ConsoleProcess::Run;
|
||||
FilePath m_workingDir;
|
||||
Environment m_environment;
|
||||
qint64 m_appPid = 0;
|
||||
qint64 m_processId = 0;
|
||||
int m_exitCode = 0;
|
||||
CommandLine m_commandLine;
|
||||
QProcess::ExitStatus m_appStatus = QProcess::NormalExit;
|
||||
@@ -657,7 +657,7 @@ void ConsoleProcess::cleanupAfterStartFailure(const QString &errorMessage)
|
||||
|
||||
void ConsoleProcess::finish(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
d->m_appPid = 0;
|
||||
d->m_processId = 0;
|
||||
d->m_exitCode = exitCode;
|
||||
d->m_appStatus = exitStatus;
|
||||
emit finished();
|
||||
@@ -700,7 +700,7 @@ void ConsoleProcess::killProcess()
|
||||
d->m_stubSocket->flush();
|
||||
}
|
||||
#endif
|
||||
d->m_appPid = 0;
|
||||
d->m_processId = 0;
|
||||
}
|
||||
|
||||
void ConsoleProcess::killStub()
|
||||
@@ -834,11 +834,11 @@ void ConsoleProcess::readStubOutput()
|
||||
// Will not need it any more
|
||||
delete d->m_tempFile;
|
||||
d->m_tempFile = nullptr;
|
||||
d->m_appPid = out.mid(4).toLongLong();
|
||||
d->m_processId = out.mid(4).toLongLong();
|
||||
|
||||
d->m_hInferior = OpenProcess(
|
||||
SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
|
||||
FALSE, d->m_appPid);
|
||||
FALSE, d->m_processId);
|
||||
if (d->m_hInferior == NULL) {
|
||||
emitError(QProcess::FailedToStart, tr("Cannot obtain a handle to the inferior: %1")
|
||||
.arg(winErrorMessage(GetLastError())));
|
||||
@@ -872,7 +872,7 @@ void ConsoleProcess::readStubOutput()
|
||||
delete d->m_tempFile;
|
||||
d->m_tempFile = nullptr;
|
||||
} else if (out.startsWith("pid ")) {
|
||||
d->m_appPid = out.mid(4).toInt();
|
||||
d->m_processId = out.mid(4).toInt();
|
||||
emit started();
|
||||
} else if (out.startsWith("exit ")) {
|
||||
finish(out.mid(5).toInt(), QProcess::NormalExit);
|
||||
@@ -905,7 +905,7 @@ void ConsoleProcess::stubExited()
|
||||
stubServerShutdown();
|
||||
delete d->m_tempFile;
|
||||
d->m_tempFile = nullptr;
|
||||
if (d->m_appPid)
|
||||
if (d->m_processId)
|
||||
finish(-1, QProcess::CrashExit);
|
||||
#endif
|
||||
}
|
||||
@@ -945,9 +945,9 @@ ConsoleProcess::Mode ConsoleProcess::mode() const
|
||||
return d->m_mode;
|
||||
}
|
||||
|
||||
qint64 ConsoleProcess::applicationPID() const
|
||||
qint64 ConsoleProcess::processId() const
|
||||
{
|
||||
return d->m_appPid;
|
||||
return d->m_processId;
|
||||
}
|
||||
|
||||
int ConsoleProcess::exitCode() const
|
||||
|
@@ -89,7 +89,7 @@ public:
|
||||
Mode mode() const;
|
||||
|
||||
bool isRunning() const; // This reflects the state of the console+stub
|
||||
qint64 applicationPID() const;
|
||||
qint64 processId() const;
|
||||
|
||||
void kickoffProcess();
|
||||
void interruptProcess();
|
||||
|
@@ -230,7 +230,7 @@ void TerminalRunner::stop()
|
||||
|
||||
void TerminalRunner::stubStarted()
|
||||
{
|
||||
m_applicationPid = m_stubProc.applicationPID();
|
||||
m_applicationPid = m_stubProc.processId();
|
||||
m_applicationMainThreadId = m_stubProc.applicationMainThreadID();
|
||||
reportStarted();
|
||||
}
|
||||
|
@@ -253,7 +253,7 @@ qint64 ApplicationLauncherPrivate::applicationPID() const
|
||||
return 0;
|
||||
|
||||
if (m_useTerminal)
|
||||
return m_consoleProcess.applicationPID();
|
||||
return m_consoleProcess.processId();
|
||||
|
||||
return m_guiProcess.processId();
|
||||
}
|
||||
@@ -297,7 +297,7 @@ void ApplicationLauncherPrivate::localGuiProcessError()
|
||||
void ApplicationLauncherPrivate::localConsoleProcessError()
|
||||
{
|
||||
emit q->appendMessage(m_consoleProcess.errorString(), ErrorMessageFormat);
|
||||
if (m_processRunning && m_consoleProcess.applicationPID() == 0) {
|
||||
if (m_processRunning && m_consoleProcess.processId() == 0) {
|
||||
m_processRunning = false;
|
||||
emit q->processExited(-1, QProcess::NormalExit);
|
||||
}
|
||||
|
Reference in New Issue
Block a user