Implement ProcessLauncher::processId()

Implement the reply confirmation for the started signal.
After qtcreator_processlauncher starts a new process
we connect to its started() signal and post a reply through
the socket to the LauncherInterface with the information about
the new PID. ProcessLauncherImpl now emits the started signal
with a delay, just after the confirmation has been received.

Change-Id: I2689e8e97b17466bd1f6b32c01909c12d80fcdef
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-07-12 15:49:20 +02:00
parent f8e0f6eb91
commit d8286adc7c
6 changed files with 61 additions and 5 deletions

View File

@@ -178,6 +178,14 @@ void LauncherSocketHandler::handleProcessError()
sendPacket(packet);
}
void LauncherSocketHandler::handleProcessStarted()
{
Process *proc = senderProcess();
ProcessStartedPacket packet(proc->token());
packet.processId = proc->processId();
sendPacket(packet);
}
void LauncherSocketHandler::handleProcessFinished()
{
Process * proc = senderProcess();
@@ -265,6 +273,7 @@ Process *LauncherSocketHandler::setupProcess(quintptr token)
{
const auto p = new Process(token, this);
connect(p, &QProcess::errorOccurred, this, &LauncherSocketHandler::handleProcessError);
connect(p, &QProcess::started, this, &LauncherSocketHandler::handleProcessStarted);
connect(p, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, &LauncherSocketHandler::handleProcessFinished);
connect(p, &Process::failedToStop, this, &LauncherSocketHandler::handleStopFailure);