Do not buffer further output when `readData()` is called on empty buffer

See comment; otherwise calls to `readAll()` with no `bytesAvailable()`
like done in the `syncthingctl` tests fail sporadically as async read
operations are started concurrently.
This commit is contained in:
Martchus 2021-07-01 17:32:49 +02:00
parent 695696bb00
commit 6cfa8a96b6
1 changed files with 1 additions and 2 deletions

View File

@ -674,8 +674,7 @@ qint64 SyncthingProcess::readData(char *data, qint64 maxSize)
return 0;
}
if (!m_process->bytesBuffered) {
bufferOutput();
return 0;
return 0; // do *not* invoke bufferOutput() here; an async read operation is already pending
}
const auto bytesAvailable = m_process->bytesBuffered - m_process->bytesRead;