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