Skip to content

Commit

Permalink
Remove reserved exit code 255 and replace it with exit code 1 (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank authored Dec 30, 2024
1 parent f374f53 commit cff5648
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/composer-dependency-analyser
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ try {
InvalidCliException $e
) {
$stdErrPrinter->printLine("\n<red>{$e->getMessage()}</red>" . PHP_EOL);
exit(255);
exit(1);

} catch (AbortException $e) {
exit(0);
Expand Down
2 changes: 1 addition & 1 deletion src/Result/ConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private function printResultErrors(

$this->printRunSummary($result);

return $hasError ? 255 : 0;
return $hasError ? 1 : 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Result/JunitFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function format(
$this->printer->print($this->prettyPrintXml($xml));

if ($hasError) {
return 255;
return 1;
}

return 0;
Expand Down
10 changes: 5 additions & 5 deletions tests/BinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ public function test(): void

$this->runCommand('php bin/composer-dependency-analyser', $rootDir, 0, $okOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --verbose', $rootDir, 0, $okOutput, $usingConfig);
$this->runCommand('php ../bin/composer-dependency-analyser', $testsDir, 255, null, $noComposerJsonError);
$this->runCommand('php ../bin/composer-dependency-analyser', $testsDir, 1, null, $noComposerJsonError);
$this->runCommand('php bin/composer-dependency-analyser --help', $rootDir, 0, $helpOutput);
$this->runCommand('php ../bin/composer-dependency-analyser --help', $testsDir, 0, $helpOutput);
$this->runCommand('php ../bin/composer-dependency-analyser --version', $testsDir, 0, $versionOutput);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json', $rootDir, 0, $okOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.lock', $rootDir, 255, null, $noPackagesError);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=README.md', $rootDir, 255, null, $parseError);
$this->runCommand('php ../bin/composer-dependency-analyser --composer-json=composer.json', $testsDir, 255, null, $noComposerJsonError);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.lock', $rootDir, 1, null, $noPackagesError);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=README.md', $rootDir, 1, null, $parseError);
$this->runCommand('php ../bin/composer-dependency-analyser --composer-json=composer.json', $testsDir, 1, null, $noComposerJsonError);
$this->runCommand('php ../bin/composer-dependency-analyser --composer-json=../composer.json --config=../composer-dependency-analyser.php', $testsDir, 0, $okOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json --format=console', $rootDir, 0, $okOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json --format=console --dump-usages=symfony/*', $rootDir, 1, $dumpingOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json --format=junit', $rootDir, 0, $junitOutput, $usingConfig);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json --format=junit --dump-usages=symfony/*', $rootDir, 255, null, $junitDumpError);
$this->runCommand('php bin/composer-dependency-analyser --composer-json=composer.json --format=junit --dump-usages=symfony/*', $rootDir, 1, null, $junitDumpError);
}

private function runCommand(
Expand Down

0 comments on commit cff5648

Please sign in to comment.