mirror of
https://github.com/danog/process.git
synced 2025-01-22 13:51:43 +01:00
Fix preconditions for getStdin / getStdout / getStderr
This commit is contained in:
parent
7cf91efd08
commit
8f9d1d234a
@ -211,6 +211,10 @@ class Process {
|
|||||||
* @return ProcessOutputStream
|
* @return ProcessOutputStream
|
||||||
*/
|
*/
|
||||||
public function getStdin(): ProcessOutputStream {
|
public function getStdin(): ProcessOutputStream {
|
||||||
|
if (!$this->handle) {
|
||||||
|
throw new StatusError("The process has not been started");
|
||||||
|
}
|
||||||
|
|
||||||
return $this->handle->stdin;
|
return $this->handle->stdin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +224,8 @@ class Process {
|
|||||||
* @return ProcessInputStream
|
* @return ProcessInputStream
|
||||||
*/
|
*/
|
||||||
public function getStdout(): ProcessInputStream {
|
public function getStdout(): ProcessInputStream {
|
||||||
if (!$this->isRunning()) {
|
if (!$this->handle) {
|
||||||
throw new StatusError("The process is not running");
|
throw new StatusError("The process has not been started");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->handle->stdout;
|
return $this->handle->stdout;
|
||||||
@ -233,8 +237,8 @@ class Process {
|
|||||||
* @return ProcessInputStream
|
* @return ProcessInputStream
|
||||||
*/
|
*/
|
||||||
public function getStderr(): ProcessInputStream {
|
public function getStderr(): ProcessInputStream {
|
||||||
if (!$this->isRunning()) {
|
if (!$this->handle) {
|
||||||
throw new StatusError("The process is not running");
|
throw new StatusError("The process has not been started");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->handle->stderr;
|
return $this->handle->stderr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user