Fix exit code 5 on composer require/create-project command (#11616)
parent
d221d5c69a
commit
90cbb144b2
|
@ -136,6 +136,7 @@ EOT
|
|||
->setApcuAutoloader($apcu, $apcuPrefix)
|
||||
->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
|
||||
->setAudit($input->getOption('audit'))
|
||||
->setErrorOnAudit($input->getOption('audit'))
|
||||
->setAuditFormat($this->getAuditFormat($input))
|
||||
;
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ class Installer
|
|||
protected $executeOperations = true;
|
||||
/** @var bool */
|
||||
protected $audit = true;
|
||||
/** @var bool */
|
||||
protected $errorOnAudit = false;
|
||||
/** @var Auditor::FORMAT_* */
|
||||
protected $auditFormat = Auditor::FORMAT_SUMMARY;
|
||||
|
||||
|
@ -402,7 +404,7 @@ class Installer
|
|||
$repoSet->addRepository($repo);
|
||||
}
|
||||
|
||||
return $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat, true, $this->config->get('audit')['ignore'] ?? []) > 0 ? self::ERROR_AUDIT_FAILED : 0;
|
||||
return $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat, true, $this->config->get('audit')['ignore'] ?? []) > 0 && $this->errorOnAudit ? self::ERROR_AUDIT_FAILED : 0;
|
||||
} catch (TransportException $e) {
|
||||
$this->io->error('Failed to audit '.$target.' packages.');
|
||||
if ($this->io->isVerbose()) {
|
||||
|
@ -1422,6 +1424,19 @@ class Installer
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should exit with status code 5 on audit error
|
||||
*
|
||||
* @param bool $errorOnAudit
|
||||
* @return Installer
|
||||
*/
|
||||
public function setErrorOnAudit(bool $errorOnAudit): self
|
||||
{
|
||||
$this->errorOnAudit = $errorOnAudit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* What format should be used for audit output?
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue