[Process] Use correct test for empty string in UnixPipes

This commit is contained in:
Manatsawin Hanmongkolchai 2014-07-01 20:28:47 +07:00 committed by Romain Neutron
parent ea45769aab
commit 9e1ea4aa4b
2 changed files with 8 additions and 2 deletions

View File

@ -313,11 +313,11 @@ class ProcessPipes
$type = array_search($pipe, $this->pipes);
$data = '';
while ($dataread = fread($pipe, self::CHUNK_SIZE)) {
while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) {
$data .= $dataread;
}
if ($data) {
if ('' !== $data) {
$read[$type] = $data;
}

View File

@ -287,6 +287,12 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
}
}
public function testZeroAsOutput(){
$p = $this->getProcess('printf 0');
$p->run();
$this->assertSame('0', $p->getOutput());
}
public function testExitCodeCommandFailed()
{
if (defined('PHP_WINDOWS_VERSION_BUILD')) {