]> granicus.if.org Git - curl/commitdiff
projects: Improve Windows perl detection in batch scripts
authorJay Satiro <raysatiro@yahoo.com>
Sat, 11 Aug 2018 20:33:12 +0000 (16:33 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 11 Aug 2018 20:33:12 +0000 (16:33 -0400)
- Determine if perl is in the user's PATH by running perl.exe.

Prior to this change detection was done by checking the PATH for perl/
but that did not work in all cases (eg git install includes perl but
not in perl/ path).

Bug: https://github.com/curl/curl/pull/2865
Reported-by: Daniel JeliƄski
projects/build-openssl.bat
projects/checksrc.bat

index 9fd49b780c520b152c587bd5c2f2f296e62dffc2..98daff52926e61a75d57f81c898fb8678d540627 100644 (file)
@@ -153,26 +153,21 @@ rem ***************************************************************************
   rem Check we have Visual Studio installed
   if not exist "%ABS_VC_PATH%" goto novc
 
-  
   if not defined PERL_PATH (
-       rem Check we have Perl in our path 
-       rem using !! below as %% was having \Microsoft was unexpected error.
-       echo !PATH! | findstr /I /C:"\Perl" 1>nul
-       if errorlevel 1 (
-               rem It isn't so check we have it installed and set the path if it is
-               if exist "%SystemDrive%\Perl" (
-               set "PATH=%SystemDrive%\Perl\bin;%PATH%"
-               ) else (
-               if exist "%SystemDrive%\Perl64" (
-                       set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
-               ) else (
-
-
-
-                       goto noperl
-               )
-               )
-       )
+    rem Check we have Perl in our path
+    perl --version <NUL 1>NUL 2>&1
+    if errorlevel 1 (
+      rem It isn't so check we have it installed and set the path if it is
+      if exist "%SystemDrive%\Perl" (
+        set "PATH=%SystemDrive%\Perl\bin;%PATH%"
+      ) else (
+        if exist "%SystemDrive%\Perl64" (
+          set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
+        ) else (
+          goto noperl
+        )
+      )
+    )
   ) else (
     set "PATH=%PERL_PATH%\Perl\bin;%PATH%"
   )
index 3c38f50e6d3731326f9d819b692a1fc9ca8daad6..5c8debf11a899272e49b91443b8e57e1aa62de8b 100644 (file)
@@ -73,7 +73,7 @@ rem ***************************************************************************
 
 :prerequisites
   rem Check we have Perl in our path
-  echo %PATH% | findstr /I /C:"\Perl" 1>nul
+  perl --version <NUL 1>NUL 2>&1
   if errorlevel 1 (
     rem It isn't so check we have it installed and set the path if it is
     if exist "%SystemDrive%\Perl" (