diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php
index fd5588fa..e6047323 100644
--- a/src/Command/BuildCommand.php
+++ b/src/Command/BuildCommand.php
@@ -91,6 +91,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$requestedNameAndVersion,
$forceInstallPackageVersion,
+ false,
);
} catch (ComposerRunFailed $composerRunFailed) {
$output->writeln('' . $composerRunFailed->getMessage() . '');
diff --git a/src/Command/DownloadCommand.php b/src/Command/DownloadCommand.php
index 9c156459..8a32f2ed 100644
--- a/src/Command/DownloadCommand.php
+++ b/src/Command/DownloadCommand.php
@@ -75,6 +75,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$requestedNameAndVersion,
$forceInstallPackageVersion,
+ false,
);
} catch (ComposerRunFailed $composerRunFailed) {
$output->writeln('' . $composerRunFailed->getMessage() . '');
diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php
index fd2c8fde..7fe8c4cf 100644
--- a/src/Command/InstallCommand.php
+++ b/src/Command/InstallCommand.php
@@ -106,6 +106,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$requestedNameAndVersion,
$forceInstallPackageVersion,
+ true,
);
} catch (ComposerRunFailed $composerRunFailed) {
$output->writeln('' . $composerRunFailed->getMessage() . '');
diff --git a/src/ComposerIntegration/ComposerIntegrationHandler.php b/src/ComposerIntegration/ComposerIntegrationHandler.php
index 4c51f724..aabf702a 100644
--- a/src/ComposerIntegration/ComposerIntegrationHandler.php
+++ b/src/ComposerIntegration/ComposerIntegrationHandler.php
@@ -32,6 +32,7 @@ public function runInstall(
TargetPlatform $targetPlatform,
RequestedPackageAndVersion $requestedPackageAndVersion,
bool $forceInstallPackageVersion,
+ bool $runCleanup,
): void {
$versionSelector = VersionSelectorFactory::make($composer, $requestedPackageAndVersion, $targetPlatform);
@@ -86,6 +87,10 @@ public function runInstall(
throw ComposerRunFailed::fromExitCode($resultCode);
}
+ if (! $runCleanup) {
+ return;
+ }
+
($this->vendorCleanup)($composer);
}