From dc92fd4d80e39534cf92c2214f11131de5a1decf Mon Sep 17 00:00:00 2001 From: lazerg Date: Tue, 30 Jun 2026 20:23:06 +0500 Subject: [PATCH 1/2] Add coverage for positional arguments with multiple binaries --- tests/Feature/BinaryResolutionTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(); From 683caa0b5409a3ff4b64264fda509279b3fe83bb Mon Sep 17 00:00:00 2001 From: Joe Tannenbaum Date: Wed, 1 Jul 2026 12:50:21 -0400 Subject: [PATCH 2/2] Update ExecCommand.php --- src/Commands/ExecCommand.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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); } }