[Console] ensure exit code between 0-254

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
This commit is contained in:
Tobias Schultze 2013-06-05 10:18:46 +02:00
parent 445b2e3dad
commit 6b9180a23d
1 changed files with 2 additions and 4 deletions

View File

@ -126,11 +126,9 @@ class Application
}
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
}