Skip to content

Commit 7734f44

Browse files
committed
[Process] added a Process:isSucessful() method
1 parent 61f1866 commit 7734f44

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ protected function doRequestInProcess($request)
235235
$process = new PhpProcess($this->getScript($request));
236236
$process->run();
237237

238-
if ($process->getExitCode() > 0) {
238+
if (!$process->isSuccessful()) {
239239
throw new \RuntimeException($process->getErrorOutput());
240240
}
241241

src/Symfony/Component/Process/Process.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ public function getExitCode()
194194
return $this->exitcode;
195195
}
196196

197+
/**
198+
* Checks if the process ended successfully.
199+
*
200+
* @return Boolean true if the process ended successfully, false otherwise
201+
*/
202+
public function isSuccessful()
203+
{
204+
return 0 == $this->exitcode;
205+
}
206+
197207
/**
198208
* Returns true if the child process has been terminated by an uncaught signal.
199209
*

0 commit comments

Comments
 (0)