Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Faild.php 886B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace think\process\exception;
  3. use think\Process;
  4. class Failed extends \RuntimeException
  5. {
  6. private $process;
  7. public function __construct(Process $process)
  8. {
  9. if ($process->isSuccessful()) {
  10. throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.');
  11. }
  12. $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText());
  13. if (!$process->isOutputDisabled()) {
  14. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput());
  15. }
  16. parent::__construct($error);
  17. $this->process = $process;
  18. }
  19. public function getProcess()
  20. {
  21. return $this->process;
  22. }
  23. }