Utils: fix QProcess backend on Windows

Do not return false from QtcProces::waitForStarted if the process is
already running. This causes mayor issues on windows since QProcess
directly emits started and therefore switches to the running state after
calling QProcess::start.

Change-Id: I4604b08a59918d3df11c8a174b57e1e483e78a0d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
David Schulz
2022-04-25 07:18:00 +02:00
parent a5a06fe355
commit 11ce6e365f
4 changed files with 59 additions and 1 deletions

View File

@@ -1166,7 +1166,9 @@ qint64 QtcProcess::processId() const
bool QtcProcess::waitForStarted(int msecs)
{
QTC_ASSERT(d->m_process, return false);
if (d->m_state != QProcess::Starting)
if (d->m_state == QProcess::Running)
return true;
if (d->m_state == QProcess::NotRunning)
return false;
return s_waitForStarted.measureAndRun(&ProcessInterface::waitForStarted, d->m_process, msecs);
}