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:
parent
603803ecb7
commit
e2ff1c3b2c
@ -46,7 +46,7 @@ exit /b 1
|
|||||||
|
|
||||||
:found-python
|
:found-python
|
||||||
echo Python found in %p%\python.exe
|
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
|
if errorlevel 1 goto :no-python
|
||||||
endlocal ^
|
endlocal ^
|
||||||
& set "pt=%p%" ^
|
& set "pt=%p%" ^
|
||||||
@ -57,7 +57,7 @@ set "need_path_ext="
|
|||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
:check-python
|
:check-python
|
||||||
%~1 -V
|
%1 -V
|
||||||
:: 9009 means error file not found
|
:: 9009 means error file not found
|
||||||
if %errorlevel% equ 9009 (
|
if %errorlevel% equ 9009 (
|
||||||
echo Not an executable Python program
|
echo Not an executable Python program
|
||||||
|
Loading…
x
Reference in New Issue
Block a user