[Process] added a Process:isSucessful() method

This commit is contained in:
Fabien Potencier 2010-09-16 08:55:44 +02:00
parent 61f18667f4
commit 7734f44bc5
2 changed files with 11 additions and 1 deletions

View File

@ -235,7 +235,7 @@ abstract class Client
$process = new PhpProcess($this->getScript($request));
$process->run();
if ($process->getExitCode() > 0) {
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}

View File

@ -194,6 +194,16 @@ class Process
return $this->exitcode;
}
/**
* Checks if the process ended successfully.
*
* @return Boolean true if the process ended successfully, false otherwise
*/
public function isSuccessful()
{
return 0 == $this->exitcode;
}
/**
* Returns true if the child process has been terminated by an uncaught signal.
*