[Process] Use stream based storage to avoid memory issues
This commit is contained in:
parent
6ec5537aed
commit
2d931f43e0
@ -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;
|
||||
|
Reference in New Issue
Block a user