Added logging for executing child processes

This commit is contained in:
Michael 2020-10-24 18:40:15 +00:00
parent 490c151e73
commit fd0e5cfe48

View file

@ -225,6 +225,7 @@ class Process
public function run($command, $args) public function run($command, $args)
{ {
if (!function_exists('proc_open')) { if (!function_exists('proc_open')) {
$this->logger->notice('"proc_open" not available - quitting');
return; return;
} }
@ -242,6 +243,7 @@ class Process
} }
if ($this->isMinMemoryReached()) { if ($this->isMinMemoryReached()) {
$this->logger->notice('Memory limit reached - quitting');
return; return;
} }
@ -251,9 +253,11 @@ class Process
$resource = proc_open($cmdline . ' &', [], $foo, $this->basePath); $resource = proc_open($cmdline . ' &', [], $foo, $this->basePath);
} }
if (!is_resource($resource)) { if (!is_resource($resource)) {
$this->logger->debug('We got no resource for command.', ['cmd' => $cmdline]); $this->logger->notice('We got no resource for command.', ['command' => $cmdline]);
return; return;
} }
proc_close($resource); proc_close($resource);
$this->logger->info('Executed "proc_open"', ['command' => $cmdline, 'callstack' => System::callstack(10)]);
} }
} }