Skip to content

Commit

Permalink
[Console] ensure exit code between 0-254
Browse files Browse the repository at this point in the history
255 is reserved by PHP and should not be used

also put this code inside the codeCoverageIgnore block because it cannot be tested with phpunit
  • Loading branch information
Tobion committed Jun 9, 2013
1 parent 445b2e3 commit 6b9180a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ public function run(InputInterface $input = null, OutputInterface $output = null
}

if ($this->autoExit) {
if ($statusCode > 255) {
$statusCode = 255;
}
// ensure exit code is between 0-254 (255 is reserved by PHP and should not be used)
// @codeCoverageIgnoreStart
exit($statusCode);
exit(max(0, min(254, $statusCode)));
// @codeCoverageIgnoreEnd
}

Expand Down

0 comments on commit 6b9180a

Please sign in to comment.