From 2faf997e73ed25e3d1612e8bf452fe81769b4e9a Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Thu, 21 Apr 2022 11:33:50 +0200 Subject: [PATCH] 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 --- tools/msvs/find_python.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 06e41fe06cd6ab..00fb6c9afbf1fc 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -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