Commit d0f9ed7e authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Utils: Consider timeout of 0 for SynchronousProcess as infinite



Makes much more sense than plain 0.

Fixes Git interactive rebase that should have no timeout.

Change-Id: I48b4d4dc35c8e5ed13e074d431d05d6795eb8797
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 1ca64999
......@@ -270,7 +270,7 @@ SynchronousProcess::~SynchronousProcess()
void SynchronousProcess::setTimeoutS(int timeoutS)
{
if (timeoutS >= 0)
if (timeoutS > 0)
d->m_maxHangTimerCount = qMax(2, timeoutS);
else
d->m_maxHangTimerCount = INT_MAX;
......@@ -599,7 +599,8 @@ bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeoutS,
bool finished = false;
bool hasData = false;
do {
finished = p.state() == QProcess::NotRunning || p.waitForFinished(timeoutS * 1000);
finished = p.state() == QProcess::NotRunning
|| p.waitForFinished(timeoutS > 0 ? timeoutS * 1000 : -1);
hasData = false;
// First check 'stdout'
if (p.bytesAvailable()) { // applies to readChannel() only
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment