From 2b73f0c4c8113afc67d86c4cbe7465fc87a2b7fb Mon Sep 17 00:00:00 2001 From: Kay Wei Date: Tue, 20 Feb 2024 16:24:14 +0800 Subject: [PATCH] Fix the `command -v` exception when the command option with a dash prefix --- src/Symfony/Component/Process/ExecutableFinder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/ExecutableFinder.php b/src/Symfony/Component/Process/ExecutableFinder.php index cc78960381fd3..8c7bf58d0daa9 100644 --- a/src/Symfony/Component/Process/ExecutableFinder.php +++ b/src/Symfony/Component/Process/ExecutableFinder.php @@ -72,7 +72,7 @@ public function find(string $name, ?string $default = null, array $extraDirs = [ } } - $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v'; + $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --'; if (\function_exists('exec') && ($executablePath = strtok(@exec($command.' '.escapeshellarg($name)), \PHP_EOL)) && @is_executable($executablePath)) { return $executablePath; }