diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 98fa66a940..32704df3f1 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -491,6 +491,10 @@ class Process */ public function getIncrementalOutput() { + if ($this->outputDisabled) { + throw new LogicException('Output has been disabled.'); + } + $this->requireProcessIsStarted(__FUNCTION__); $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset); @@ -510,7 +514,8 @@ class Process */ public function clearOutput() { - $this->stdout = ''; + ftruncate($this->stdout, 0); + fseek($this->stdout, 0); $this->incrementalOutputOffset = 0; return $this; @@ -555,6 +560,10 @@ class Process */ public function getIncrementalErrorOutput() { + if ($this->outputDisabled) { + throw new LogicException('Output has been disabled.'); + } + $this->requireProcessIsStarted(__FUNCTION__); $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset); @@ -574,7 +583,8 @@ class Process */ public function clearErrorOutput() { - $this->stderr = ''; + ftruncate($this->stderr, 0); + fseek($this->stderr, 0); $this->incrementalErrorOutputOffset = 0; return $this;