mirror of
https://github.com/danog/process.git
synced 2024-11-30 04:39:04 +01:00
Fix tests
This commit is contained in:
parent
b0e690d3ee
commit
717dabc883
@ -3,7 +3,7 @@
|
|||||||
"homepage": "https://github.com/amphp/process",
|
"homepage": "https://github.com/amphp/process",
|
||||||
"description": "Asynchronous process manager.",
|
"description": "Asynchronous process manager.",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7",
|
"php": ">=7.2",
|
||||||
"amphp/amp": "dev-ext-task",
|
"amphp/amp": "dev-ext-task",
|
||||||
"amphp/byte-stream": "dev-ext-task"
|
"amphp/byte-stream": "dev-ext-task"
|
||||||
},
|
},
|
||||||
|
@ -53,6 +53,9 @@ class ProcessInputStream implements InputStream
|
|||||||
if ($this->shouldClose) {
|
if ($this->shouldClose) {
|
||||||
if ($this->resourceStream->getResource()) {
|
if ($this->resourceStream->getResource()) {
|
||||||
$this->buffer .= \stream_get_contents($this->resourceStream->getResource());
|
$this->buffer .= \stream_get_contents($this->resourceStream->getResource());
|
||||||
|
if ($this->buffer === "") {
|
||||||
|
$this->buffer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resourceStream->close();
|
$this->resourceStream->close();
|
||||||
@ -125,8 +128,11 @@ class ProcessInputStream implements InputStream
|
|||||||
{
|
{
|
||||||
$this->shouldClose = true;
|
$this->shouldClose = true;
|
||||||
|
|
||||||
if ($this->resourceStream->getResource()) {
|
if ($this->resourceStream && $this->resourceStream->getResource()) {
|
||||||
$this->buffer .= \stream_get_contents($this->resourceStream->getResource());
|
$this->buffer .= \stream_get_contents($this->resourceStream->getResource());
|
||||||
|
if ($this->buffer === "") {
|
||||||
|
$this->buffer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->initialRead) {
|
if ($this->initialRead) {
|
||||||
|
@ -44,6 +44,7 @@ class ProcessTest extends TestCase
|
|||||||
/** @noinspection PhpUnhandledExceptionInspection */
|
/** @noinspection PhpUnhandledExceptionInspection */
|
||||||
$process->start();
|
$process->start();
|
||||||
|
|
||||||
|
$process->getStdout()->read();
|
||||||
$code = $process->join();
|
$code = $process->join();
|
||||||
|
|
||||||
$this->assertSame(42, $code);
|
$this->assertSame(42, $code);
|
||||||
|
Loading…
Reference in New Issue
Block a user