8000 [Process] Use stream based storage to avoid memory issues · symfony/symfony@2d931f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d931f4

Browse files
committed
[Process] Use stream based storage to avoid memory issues
1 parent 6ec5537 commit 2d931f4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ public function getOutput()
491491
*/
492492
public function getIncrementalOutput()
493493
{
494+
if ($this->outputDisabled) {
495+
throw new LogicException('Output has been disabled.');
496+
}
497+
494498
$this->requireProcessIsStarted(__FUNCTION__);
495499

496500
$latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
@@ -510,7 +514,8 @@ public function getIncrementalOutput()
510514
*/
511515
public function clearOutput()
512516
{
513-
$this->stdout = '';
517+
ftruncate($this->stdout, 0);
518+
fseek($this->stdout, 0);
514519
$this->incrementalOutputOffset = 0;
515520

516521
return $this;
@@ -555,6 +560,10 @@ public function getErrorOutput()
555560
*/
556561
public function getIncrementalErrorOutput()
557562
{
563+
if ($this->outputDisabled) {
564+
throw new LogicException('Output has been disabled.');
565+
}
566+
558567
$this->requireProcessIsStarted(__FUNCTION__);
559568

560569
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
@@ -574,7 +583,8 @@ public function getIncrementalErrorOutput()
574583
*/
575584
public function clearErrorOutput()
576585
{
577-
$this->stderr = '';
586+
ftruncate($this->stderr, 0);
587+
fseek($this->stderr, 0);
578588
$this->incrementalErrorOutputOffset = 0;
579589

580590
return $this;

0 commit comments

Comments
 (0)
0