/** * @param Process $process * @return null * @throws CommandsExecutionException */ public static function tryTerminateProcess(Process $process) { try { $terminationResult = $process->terminate(); if (!$terminationResult) { throw new CommandsExecutionException("Process termination for PID " . $process->getPid() . " wasn't success"); } } catch (\Exception $e) { try { self::sendSig($process->getPid(), SIGKILL); } catch (\Exception $e) { throw new CommandsExecutionException("SIGKILL for PID " . $process->getPid() . " wasn't success"); } } return null; }
public function tryTerminateProcess(Process $process) { try { $terminationResult = $process->terminate(); if (!$terminationResult) { throw new ReactManagerException("Process termination for PID " . $process->getPid() . " wasn't success"); } } catch (\Exception $e) { try { $this->logAndSendSigKill($process->getPid(), $e); } catch (\Exception $e) { $this->logger->warning("Parent process can't be sigKilled."); } } return null; }
/** * @return null * @throws \CommandsExecutor\Inventory\Exceptions\CommandsExecutionException */ protected function stopReplyStack() { LinuxCommands::sendSigTermOrKill($this->commandsManager->getPidByPpid($this->replyStackProcess->getPid())->getPid()); LinuxCommands::tryTerminateProcess($this->replyStackProcess); return null; }