QtcProcess: Fix behavior of kill()

Make it behave more like QProcess::kill().

Before, when QtcProcess::kill() has been called,
the process launcher was putting the process into the
reaper and notified the QtcProcess that it was already killed,
while in fact it could still be alive for a while since it
was in reaper's hands. The current fix makes the behavior
similar to what QProcess does when calling kill(). So now,
in case of a call to kill() the process isn't put into the reaper yet,
so it has a chance to report back the finished signal when the
process was really stopped.

We still use the old behavior of putting the running process
into the reaper in case of a call to QtcProcess::close() and
when d'tor of QtcProcess was called. We don't report back the
confirmation about putting the process into the reaper, since
close() is always called from ProcessLauncherImpl d'tor, so
there is no one to receive this confirmation anyway.

Change-Id: I665e7c8fb1a391dda30c86389259961e715926d6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-05-16 11:05:17 +02:00
parent 4ab935349f
commit f301bb3f97
5 changed files with 20 additions and 23 deletions

View File

@@ -437,7 +437,7 @@ public:
}
~ProcessLauncherImpl() final
{
m_handle->kill();
m_handle->close();
LauncherInterface::unregisterHandle(token());
m_handle = nullptr;
}