From 3887e154eeaa4f600e5085d4e1811cd09782f013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20R=C3=B3bert?= Date: Wed, 5 Aug 2026 15:19:00 +0300 Subject: [PATCH 1/3] Don't check on windows if the wp-cli is executable --- src/Path/Finder/WpCliPathFinder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Path/Finder/WpCliPathFinder.php b/src/Path/Finder/WpCliPathFinder.php index 2c370b6..319768b 100644 --- a/src/Path/Finder/WpCliPathFinder.php +++ b/src/Path/Finder/WpCliPathFinder.php @@ -35,10 +35,15 @@ public function find(): string throw new Exception(); } - if (!$firstMatch->isExecutable()) { + if (!$this->isWindows() && !$firstMatch->isExecutable()) { throw new Exception('The matched WP-CLI binary is not executable.'); } return $firstMatch->getPathname(); } + + private function isWindows(): bool + { + return \DIRECTORY_SEPARATOR === '\\'; + } } From 68a59e2311236b2e2fcfa714abfafbbda0d39af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20R=C3=B3bert?= Date: Wed, 5 Aug 2026 15:20:49 +0300 Subject: [PATCH 2/3] Skip the test on windows --- tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php b/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php index 715b58d..75c75ae 100644 --- a/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php +++ b/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php @@ -51,6 +51,10 @@ public function testWpContentDirectoryIsIgnoredWhenWpCliIsLocated(): void public function testThrowsWhenLocatedWpCliIsNotExecutable(): void { + if (\DIRECTORY_SEPARATOR === '\\') { + $this->markTestSkipped('Windows has no POSIX file permissions to test.'); + } + $this->expectExceptionMessageMatches('/The matched WP-CLI binary is not executable/'); $this->filesystem->appendToFile($this->workspace . '/acme/vendor/bin/wp', ''); From 6ec82cd60b393a3f0ef90a5320d2238711b103be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20R=C3=B3bert?= Date: Wed, 5 Aug 2026 15:21:01 +0300 Subject: [PATCH 3/3] Make the non executable permission explicit --- tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php b/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php index 75c75ae..6ae89b8 100644 --- a/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php +++ b/tests/phpunit/Functional/Path/Finder/WpCliPathFinderTest.php @@ -58,6 +58,7 @@ public function testThrowsWhenLocatedWpCliIsNotExecutable(): void $this->expectExceptionMessageMatches('/The matched WP-CLI binary is not executable/'); $this->filesystem->appendToFile($this->workspace . '/acme/vendor/bin/wp', ''); + $this->filesystem->chmod($this->workspace . '/acme/vendor/bin/wp', 0644); (new WpCliPathFinder( $this->localDependencyPath($this->workspace . '/acme'),