Skip to content

Commit

Permalink
[Console] fix status code when Exception::getCode returns something l…
Browse files Browse the repository at this point in the history
…ike 0.1
  • Loading branch information
Tobion committed Jun 5, 2013
1 parent 28a9001 commit 445b2e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -113,9 +113,16 @@ public function run(InputInterface $input = null, OutputInterface $output = null
} else {
$this->renderException($e, $output);
}
$statusCode = $e->getCode();

$statusCode = is_numeric($statusCode) && $statusCode ? (int) $statusCode : 1;
$statusCode = $e->getCode();
if (is_numeric($statusCode)) {
$statusCode = (int) $statusCode;
if (0 === $statusCode) {
$statusCode = 1;
}
} else {
$statusCode = 1;
}
}

if ($this->autoExit) {
Expand Down

0 comments on commit 445b2e3

Please sign in to comment.