Change exit code to be 1/2 for warn/fail, refs #5601
parent
b29d810d63
commit
a04256810e
|
@ -40,7 +40,7 @@ class DiagnoseCommand extends BaseCommand
|
||||||
protected $process;
|
protected $process;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $failures = 0;
|
protected $exitCode = 0;
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,8 @@ class DiagnoseCommand extends BaseCommand
|
||||||
->setHelp(<<<EOT
|
->setHelp(<<<EOT
|
||||||
The <info>diagnose</info> command checks common errors to help debugging problems.
|
The <info>diagnose</info> command checks common errors to help debugging problems.
|
||||||
|
|
||||||
|
The process exit code will be 1 in case of warnings and 2 for errors.
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
@ -147,7 +149,7 @@ EOT
|
||||||
$this->outputResult($this->checkVersion($config));
|
$this->outputResult($this->checkVersion($config));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->failures;
|
return $this->exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkComposerSchema()
|
private function checkComposerSchema()
|
||||||
|
@ -385,12 +387,12 @@ EOT
|
||||||
private function outputResult($result)
|
private function outputResult($result)
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$hadError = false;
|
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
$io->write('<info>OK</info>');
|
$io->write('<info>OK</info>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hadError = false;
|
||||||
if ($result instanceof \Exception) {
|
if ($result instanceof \Exception) {
|
||||||
$result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
|
$result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
|
||||||
}
|
}
|
||||||
|
@ -411,9 +413,10 @@ EOT
|
||||||
|
|
||||||
if ($hadError) {
|
if ($hadError) {
|
||||||
$io->write('<error>FAIL</error>');
|
$io->write('<error>FAIL</error>');
|
||||||
$this->failures++;
|
$this->exitCode = 2;
|
||||||
} else {
|
} else {
|
||||||
$io->write('<warning>WARNING</warning>');
|
$io->write('<warning>WARNING</warning>');
|
||||||
|
$this->exitCode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
Loading…
Reference in New Issue