瀏覽代碼

[Process] added a Process:isSucessful() method

Fabien Potencier 14 年之前
父節點
當前提交
7734f44bc5
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 1 1
      src/Symfony/Component/BrowserKit/Client.php
  2. 10 0
      src/Symfony/Component/Process/Process.php

+ 1 - 1
src/Symfony/Component/BrowserKit/Client.php

@@ -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());
         }
 

+ 10 - 0
src/Symfony/Component/Process/Process.php

@@ -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.
      *