forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
1ca649994c
commit
d0f9ed7ea4
@@ -270,7 +270,7 @@ SynchronousProcess::~SynchronousProcess()
|
|||||||
|
|
||||||
void SynchronousProcess::setTimeoutS(int timeoutS)
|
void SynchronousProcess::setTimeoutS(int timeoutS)
|
||||||
{
|
{
|
||||||
if (timeoutS >= 0)
|
if (timeoutS > 0)
|
||||||
d->m_maxHangTimerCount = qMax(2, timeoutS);
|
d->m_maxHangTimerCount = qMax(2, timeoutS);
|
||||||
else
|
else
|
||||||
d->m_maxHangTimerCount = INT_MAX;
|
d->m_maxHangTimerCount = INT_MAX;
|
||||||
@@ -599,7 +599,8 @@ bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeoutS,
|
|||||||
bool finished = false;
|
bool finished = false;
|
||||||
bool hasData = false;
|
bool hasData = false;
|
||||||
do {
|
do {
|
||||||
finished = p.state() == QProcess::NotRunning || p.waitForFinished(timeoutS * 1000);
|
finished = p.state() == QProcess::NotRunning
|
||||||
|
|| p.waitForFinished(timeoutS > 0 ? timeoutS * 1000 : -1);
|
||||||
hasData = false;
|
hasData = false;
|
||||||
// First check 'stdout'
|
// First check 'stdout'
|
||||||
if (p.bytesAvailable()) { // applies to readChannel() only
|
if (p.bytesAvailable()) { // applies to readChannel() only
|
||||||
|
|||||||
Reference in New Issue
Block a user