From f9994e2029a71b1e9da83765112043b86c584911 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 23 Apr 2022 21:45:27 +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 PR-URL: https://github.com/nodejs/node/pull/42810 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- 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