diff --git a/src/Commands/ExecCommand.php b/src/Commands/ExecCommand.php index c31ac47..07aa662 100644 --- a/src/Commands/ExecCommand.php +++ b/src/Commands/ExecCommand.php @@ -38,9 +38,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } finally { $contents = ob_get_clean(); - if ($contents !== false) { - $output->write($contents); - } + $output->write($contents); } } diff --git a/tests/Feature/BinaryResolutionTest.php b/tests/Feature/BinaryResolutionTest.php index 62d7d55..cbcb92e 100644 --- a/tests/Feature/BinaryResolutionTest.php +++ b/tests/Feature/BinaryResolutionTest.php @@ -29,6 +29,21 @@ ->and(json_decode((string) file_get_contents($logFile), true))->toBe(['--flag']); }); +test('a package with multiple binaries keeps a positional argument when a binary matches the package name', function () { + $this->useIsolatedComposerHome(); + $logFile = $this->temporaryDirectory('cpx-log').'/argv.json'; + + prepareCachedPackage('vendor/package', ['package', 'other'], [ + 'package' => "#!/usr/bin/env php\n "#!/usr/bin/env php\ntoBe(0) + ->and(json_decode((string) file_get_contents($logFile), true))->toBe(['tests/Sub']); +}); + test('ambiguous multiple-binary packages list the available binaries', function () { $this->useIsolatedComposerHome();