From 85e77b14f7a0c2c0e8ada500421b7a1bcf6f1836 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Thu, 7 Aug 2014 09:02:32 +0200 Subject: [PATCH] add way to test command under windows --- src/Symfony/Component/Finder/Shell/Shell.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Finder/Shell/Shell.php b/src/Symfony/Component/Finder/Shell/Shell.php index f65f16d372da..7c57e7b7f9fe 100644 --- a/src/Symfony/Component/Finder/Shell/Shell.php +++ b/src/Symfony/Component/Finder/Shell/Shell.php @@ -50,19 +50,19 @@ public function getType() */ public function testCommand($command) { - if (self::TYPE_WINDOWS === $this->type) { - // todo: find a way to test if Windows command exists + if (!function_exists('exec')) { return false; } - if (!function_exists('exec')) { - return false; + // todo: find a better way (command could not be available) + $testCommand = 'command -v '; + if (self::TYPE_WINDOWS === $this->type) { + $testCommand = 'where '; } $command = escapeshellcmd($command); - // todo: find a better way (command could not be available) - exec('command -v '.$command, $output, $code); + exec($testCommand . $command, $output, $code); return 0 === $code && count($output) > 0; }