Tweak exit code for network errors to be 100, refs #11954
parent
acf398281c
commit
762f2a37f5
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace Composer\Console;
|
||||
|
||||
use Composer\Installer;
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Platform;
|
||||
|
@ -441,6 +442,13 @@ class Application extends BaseApplication
|
|||
return max(1, $e->getCode());
|
||||
}
|
||||
|
||||
// override TransportException's code for the purpose of parent::run() using it as process exit code
|
||||
// as http error codes are all beyond the 255 range of permitted exit codes
|
||||
if ($e instanceof TransportException) {
|
||||
$reflProp = new \ReflectionProperty($e, 'code');
|
||||
$reflProp->setValue($e, Installer::ERROR_TRANSPORT_EXCEPTION);
|
||||
}
|
||||
|
||||
throw $e;
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
|
|
|
@ -80,8 +80,8 @@ class Installer
|
|||
// used/declared in SolverProblemsException, carried over here for completeness
|
||||
public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
|
||||
public const ERROR_AUDIT_FAILED = 5;
|
||||
// technically exceptions are thrown with various status codes >400, but the process exit code is normalized to 255
|
||||
public const ERROR_TRANSPORT_EXCEPTION = 255;
|
||||
// technically exceptions are thrown with various status codes >400, but the process exit code is normalized to 100
|
||||
public const ERROR_TRANSPORT_EXCEPTION = 100;
|
||||
|
||||
/**
|
||||
* @var IOInterface
|
||||
|
|
Loading…
Reference in New Issue