[Process] Reduce I/O load on Windows platform

This commit is contained in:
Romain Neutron 2014-06-14 14:38:29 +02:00
parent ace5a29867
commit ff0bb01a91
2 changed files with 10 additions and 1 deletions

View File

@ -284,6 +284,8 @@ class ProcessPipes
private function readStreams($blocking, $close = false)
{
if (empty($this->pipes)) {
usleep(Process::TIMEOUT_PRECISION * 1E4);
return array();
}

View File

@ -583,7 +583,14 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
}
$duration = microtime(true) - $start;
$this->assertLessThan($timeout + Process::TIMEOUT_PRECISION, $duration);
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
// Windows is a bit slower as it read file handles, then allow twice the precision
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
} else {
$maxDuration = $timeout + Process::TIMEOUT_PRECISION;
}
$this->assertLessThan($maxDuration, $duration);
}
public function testCheckTimeoutOnNonStartedProcess()