From 325813ea97ff03594db845392c8f6d482d886556 Mon Sep 17 00:00:00 2001 From: Jason Ginchereau Date: Sun, 30 Jul 2017 23:32:43 -0700 Subject: [PATCH] build,win: fix python detection script Handle spaces in the path to python.exe, in case it is installed under some directory like "C:\Program Files". Backport-PR-URL: https://github.com/nodejs/node/pull/14842 PR-URL: https://github.com/nodejs/node/pull/14546 Reviewed-By: Timothy Gu Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- tools/msvs/find_python.cmd | 2 +- vcbuild.bat | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 9b67764c7563ff..f2a779290e8104 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -41,7 +41,7 @@ EXIT /B 1 :validate IF NOT EXIST "%p%python.exe" EXIT /B 1 :: Check if %p% is python2 -%p%python.exe -V 2>&1 | findstr /R "^Python.2.*" > NUL +"%p%python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL% :: We can wrap it up ENDLOCAL & SET pt=%p%& SET need_path_ext=%need_path% diff --git a/vcbuild.bat b/vcbuild.bat index 08a396d6644588..1b933b05686c1b 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -378,7 +378,7 @@ goto exit :run-python call tools\msvs\find_python.cmd if errorlevel 1 echo Could not find python2 & goto :exit -set cmd1=%VCBUILD_PYTHON_LOCATION% %* +set cmd1="%VCBUILD_PYTHON_LOCATION%" %* echo %cmd1% %cmd1% exit /b %ERRORLEVEL% @@ -396,7 +396,7 @@ set TAG= set FULLVERSION= :: Call as subroutine for validation of python call :run-python tools\getnodeversion.py > nul -for /F "tokens=*" %%i in ('%VCBUILD_PYTHON_LOCATION% tools\getnodeversion.py') do set NODE_VERSION=%%i +for /F "tokens=*" %%i in ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') do set NODE_VERSION=%%i if not defined NODE_VERSION ( echo Cannot determine current version of Node.js exit /b 1