Keine Beschreibung

ProcessSignaledException.php 945B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Process\Exception;
  11. use Symfony\Component\Process\Process;
  12. /**
  13. * Exception that is thrown when a process has been signaled.
  14. *
  15. * @author Sullivan Senechal <soullivaneuh@gmail.com>
  16. */
  17. final class ProcessSignaledException extends RuntimeException
  18. {
  19. private $process;
  20. public function __construct(Process $process)
  21. {
  22. $this->process = $process;
  23. parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
  24. }
  25. public function getProcess(): Process
  26. {
  27. return $this->process;
  28. }
  29. public function getSignal(): int
  30. {
  31. return $this->getProcess()->getTermSignal();
  32. }
  33. }