From 0ba7e0dcbd92b8225177c1ad796c4a9a70560cb5 Mon Sep 17 00:00:00 2001 From: Ion Bazan Date: Thu, 16 Mar 2023 05:11:23 +0800 Subject: [PATCH] Exit with non-zero code if post-install audit fails (#11362) --- src/Composer/Installer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 57890e3cd..205648f03 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -79,6 +79,7 @@ class Installer public const ERROR_LOCK_FILE_INVALID = 4; // used/declared in SolverProblemsException, carried over here for completeness public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2; + public const ERROR_AUDIT_FAILED = 5; /** * @var IOInterface @@ -400,7 +401,8 @@ class Installer foreach ($this->repositoryManager->getRepositories() as $repo) { $repoSet->addRepository($repo); } - $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat); + + return $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat) > 0 ? self::ERROR_AUDIT_FAILED : 0; } catch (TransportException $e) { $this->io->error('Failed to audit '.$target.' packages.'); if ($this->io->isVerbose()) {