mirror of
https://github.com/danog/process.git
synced 2024-11-26 20:24:43 +01:00
Rename InputStream / OutputStream
This might seem weird, but the output streams of a child process are input streams, because you read from them. There will be confusion no matter which names we choose, but I think it's less confusing if the class names match STDIN / STDOUT than matching the interface names.
This commit is contained in:
parent
a338f10d27
commit
b2126ce56d
@ -5,7 +5,7 @@ namespace Amp\Process;
|
||||
use Amp\ByteStream\OutputStream;
|
||||
use Amp\ByteStream\ResourceOutputStream;
|
||||
|
||||
class ProcessOutputStream implements OutputStream
|
||||
class InputStream implements OutputStream
|
||||
{
|
||||
/** @var ResourceOutputStream */
|
||||
private $resourceStream;
|
@ -9,8 +9,8 @@ use Amp\Process\Internal\ProcessHandle;
|
||||
use Amp\Process\Internal\ProcessRunner;
|
||||
use Amp\Process\Internal\ProcessStatus;
|
||||
use Amp\Process\ProcessException;
|
||||
use Amp\Process\ProcessInputStream;
|
||||
use Amp\Process\ProcessOutputStream;
|
||||
use Amp\Process\OutputStream;
|
||||
use Amp\Process\InputStream;
|
||||
use Concurrent\Deferred;
|
||||
use Concurrent\Task;
|
||||
|
||||
@ -165,9 +165,9 @@ final class Runner implements ProcessRunner
|
||||
Loop::unreference($handle->extraDataPipeWatcher);
|
||||
Loop::disable($handle->extraDataPipeWatcher);
|
||||
|
||||
$handle->stdin = new ProcessOutputStream(Task::await($stdinDeferred->awaitable()));
|
||||
$handle->stdout = new ProcessInputStream(Task::await($stdoutDeferred->awaitable()));
|
||||
$handle->stderr = new ProcessInputStream(Task::await($stderrDeferred->awaitable()));
|
||||
$handle->stdin = new InputStream(Task::await($stdinDeferred->awaitable()));
|
||||
$handle->stdout = new OutputStream(Task::await($stdoutDeferred->awaitable()));
|
||||
$handle->stderr = new OutputStream(Task::await($stderrDeferred->awaitable()));
|
||||
|
||||
return $handle;
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Amp\Process\Internal;
|
||||
|
||||
use Amp\Process\ProcessInputStream;
|
||||
use Amp\Process\ProcessOutputStream;
|
||||
use Amp\Process\OutputStream;
|
||||
use Amp\Process\InputStream;
|
||||
use Amp\Struct;
|
||||
use Concurrent\Deferred;
|
||||
|
||||
@ -11,13 +11,13 @@ abstract class ProcessHandle
|
||||
{
|
||||
use Struct;
|
||||
|
||||
/** @var ProcessOutputStream */
|
||||
/** @var InputStream */
|
||||
public $stdin;
|
||||
|
||||
/** @var ProcessInputStream */
|
||||
/** @var OutputStream */
|
||||
public $stdout;
|
||||
|
||||
/** @var ProcessInputStream */
|
||||
/** @var OutputStream */
|
||||
public $stderr;
|
||||
|
||||
/** @var Deferred */
|
||||
|
@ -7,8 +7,8 @@ use Amp\Process\Internal\ProcessHandle;
|
||||
use Amp\Process\Internal\ProcessRunner;
|
||||
use Amp\Process\Internal\ProcessStatus;
|
||||
use Amp\Process\ProcessException;
|
||||
use Amp\Process\ProcessInputStream;
|
||||
use Amp\Process\ProcessOutputStream;
|
||||
use Amp\Process\OutputStream;
|
||||
use Amp\Process\InputStream;
|
||||
use Concurrent\Deferred;
|
||||
use Concurrent\Task;
|
||||
use const Amp\Process\BIN_DIR;
|
||||
@ -127,9 +127,9 @@ final class Runner implements ProcessRunner
|
||||
|
||||
$this->socketConnector->registerPendingProcess($handle);
|
||||
|
||||
$handle->stdin = new ProcessOutputStream(Task::await($stdinDeferred->awaitable()));
|
||||
$handle->stdout = new ProcessInputStream(Task::await($stdoutDeferred->awaitable()));
|
||||
$handle->stderr = new ProcessInputStream(Task::await($stderrDeferred->awaitable()));
|
||||
$handle->stdin = new InputStream(Task::await($stdinDeferred->awaitable()));
|
||||
$handle->stdout = new OutputStream(Task::await($stdoutDeferred->awaitable()));
|
||||
$handle->stderr = new OutputStream(Task::await($stderrDeferred->awaitable()));
|
||||
|
||||
return $handle;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Amp\Process;
|
||||
use Amp\ByteStream\InputStream;
|
||||
use Amp\ByteStream\ResourceInputStream;
|
||||
|
||||
class ProcessInputStream implements InputStream
|
||||
class OutputStream implements InputStream
|
||||
{
|
||||
/** @var ResourceInputStream */
|
||||
private $resourceStream;
|
@ -223,9 +223,9 @@ class Process
|
||||
/**
|
||||
* Gets the process input stream (STDIN).
|
||||
*
|
||||
* @return ProcessOutputStream
|
||||
* @return InputStream
|
||||
*/
|
||||
public function getStdin(): ProcessOutputStream
|
||||
public function getStdin(): InputStream
|
||||
{
|
||||
if (!$this->handle) {
|
||||
throw new StatusError("Process has not been started.");
|
||||
@ -237,9 +237,9 @@ class Process
|
||||
/**
|
||||
* Gets the process output stream (STDOUT).
|
||||
*
|
||||
* @return ProcessInputStream
|
||||
* @return OutputStream
|
||||
*/
|
||||
public function getStdout(): ProcessInputStream
|
||||
public function getStdout(): OutputStream
|
||||
{
|
||||
if (!$this->handle) {
|
||||
throw new StatusError("Process has not been started.");
|
||||
@ -251,9 +251,9 @@ class Process
|
||||
/**
|
||||
* Gets the process error stream (STDERR).
|
||||
*
|
||||
* @return ProcessInputStream
|
||||
* @return OutputStream
|
||||
*/
|
||||
public function getStderr(): ProcessInputStream
|
||||
public function getStderr(): OutputStream
|
||||
{
|
||||
if (!$this->handle) {
|
||||
throw new StatusError("Process has not been started.");
|
||||
|
Loading…
Reference in New Issue
Block a user