소스 검색

[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 = new PhpProcess($this->getScript($request));
         $process->run();
         $process->run();
 
 
-        if ($process->getExitCode() > 0) {
+        if (!$process->isSuccessful()) {
             throw new \RuntimeException($process->getErrorOutput());
             throw new \RuntimeException($process->getErrorOutput());
         }
         }
 
 

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

@@ -194,6 +194,16 @@ class Process
         return $this->exitcode;
         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.
      * Returns true if the child process has been terminated by an uncaught signal.
      *
      *