getExitCode() public method

Returns exit code.
public getExitCode ( ) : integer
return integer
コード例 #1
0
 public function __construct($path, $args = NULL)
 {
     $this->path = Helpers::escapeArg($path);
     $proc = proc_open("{$this->path} -n {$args} -v", array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes, NULL, NULL, array('bypass_shell' => TRUE));
     $output = stream_get_contents($pipes[1]);
     $this->error = trim(stream_get_contents($pipes[2]));
     if (proc_close($proc)) {
         throw new \Exception("Unable to run '{$path}': " . preg_replace('#[\\r\\n ]+#', ' ', $this->error));
     } elseif (!preg_match('#^PHP (\\S+).*c(g|l)i#i', $output, $matches)) {
         throw new \Exception("Unable to detect PHP version (output: {$output}).");
     }
     $this->version = $matches[1];
     $this->cgi = strcasecmp($matches[2], 'g') === 0;
     $this->arguments = $args;
     $job = new Job(__DIR__ . '/info.php', $this, array('xdebug'));
     $job->run();
     $this->xdebug = !$job->getExitCode();
 }
コード例 #2
0
ファイル: TestHandler.php プロジェクト: xnovk/test
 private function assessExitCode(Job $job, $code)
 {
     $code = (int) $code;
     if ($job->getExitCode() === Job::CODE_SKIP) {
         $message = preg_match('#.*Skipped:\\n(.*?)\\z#s', $output = $job->getOutput(), $m) ? $m[1] : $output;
         return array(Runner::SKIPPED, trim($message));
     } elseif ($job->getExitCode() !== $code) {
         $message = $job->getExitCode() !== Job::CODE_FAIL ? "Exited with error code {$job->getExitCode()} (expected {$code})" : '';
         return array(Runner::FAILED, trim($message . "\n" . $job->getOutput()));
     }
 }