build: improve reliability of find_python.cmd script

The path of the Python executable might contain white spaces. Handle
this when the `check-python` function is called.

Fixes: https://github.com/nodejs/node/issues/42801

PR-URL: https://github.com/nodejs/node/pull/42810
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Luigi Pinca authored and GitHub committed 2022-04-23 20:45:27 +01:00
1 parent 603803ecb7
commit e2ff1c3b2c
1 file changed
+2 -2
+2 -2
View File
@@ -46,7 +46,7 @@ exit /b 1
:found-python
echo Python found in %p%\python.exe
call :check-python %p%\python.exe
call :check-python "%p%\python.exe"
if errorlevel 1 goto :no-python
endlocal ^
& set "pt=%p%" ^
@@ -57,7 +57,7 @@ set "need_path_ext="
exit /b 0
:check-python
%~1 -V
%1 -V
:: 9009 means error file not found
if %errorlevel% equ 9009 (
echo Not an executable Python program