added knp-snappy package for Jerry's UB04 work
[openemr.git] / vendor / symfony / process / Exception / ProcessFailedException.php
blob328acfde5e88358313c365de13738d70a66755f1
1 <?php
3 /*
4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Process\Exception;
14 use Symfony\Component\Process\Process;
16 /**
17 * Exception for failed processes.
19 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
21 class ProcessFailedException extends RuntimeException
23 private $process;
25 public function __construct(Process $process)
27 if ($process->isSuccessful()) {
28 throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
31 $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
32 $process->getCommandLine(),
33 $process->getExitCode(),
34 $process->getExitCodeText(),
35 $process->getWorkingDirectory()
38 if (!$process->isOutputDisabled()) {
39 $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
40 $process->getOutput(),
41 $process->getErrorOutput()
45 parent::__construct($error);
47 $this->process = $process;
50 public function getProcess()
52 return $this->process;