diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-11-13 04:19:20 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-11-13 06:16:54 +0300 |
commit | 320b0f19ef4b1cbe4fffaba5488a4a2d518313fd (patch) | |
tree | a93fbb9d9f335624faf6224035e89df6851b6e33 /core/CliMulti.php | |
parent | be899f7a6a562cc2d670e610c7bfbbf0f6f73148 (diff) |
refs #6617 if process or output size is too large, declare it as finished
Declares a process as finished as soon as a PID file is > 500bytes
(contains only PID) and output file is > 100MB (which should usually
not be larger than 100KB or 1MB) to prevent files growing up to many
GBs. I added unit and integration tests for the file size detection. It is
now possible to mock the methods file_exists and filesize although very
simple so far. Later we can allow to define callbacks or to define different
return values for different files or we can use something like vfsStream
Diffstat (limited to 'core/CliMulti.php')
-rw-r--r-- | core/CliMulti.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/CliMulti.php b/core/CliMulti.php index 992a4e1dd4..26befbc8ef 100644 --- a/core/CliMulti.php +++ b/core/CliMulti.php @@ -151,6 +151,14 @@ class CliMulti { return false; } + $pid = $process->getPid(); + foreach ($this->outputs as $output) { + if ($output->getOutputId() === $pid && $output->isAbnormal()) { + $process->finishProcess(); + return true; + } + } + if ($process->hasFinished()) { // prevent from checking this process over and over again unset($this->processes[$index]); |