mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
build: check if python is a executable program
After Windows 10 version 1903, placeholder files named "python.exe" and "python3.exe" appear, not executable programs, and open the MS Store when running without parameters. Fixes: https://github.com/nodejs/node/issues/36694 Refs: https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update PR-URL: https://github.com/nodejs/node/pull/36696 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
14cb9ea93e
commit
adcde6bb78
1 file changed
+11
@@ -46,6 +46,8 @@ exit /b 1
|
||||
|
||||
:found-python
|
||||
echo Python found in %p%\python.exe
|
||||
call :check-python %p%\python.exe
|
||||
if errorlevel 1 goto :no-python
|
||||
endlocal ^
|
||||
& set "pt=%p%" ^
|
||||
& set "need_path_ext=%need_path%"
|
||||
@@ -54,6 +56,15 @@ set "pt="
|
||||
set "need_path_ext="
|
||||
exit /b 0
|
||||
|
||||
:check-python
|
||||
%~1 -V
|
||||
:: 9009 means error file not found
|
||||
if %errorlevel% equ 9009 (
|
||||
echo Not an executable Python program
|
||||
exit /b 1
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:no-python
|
||||
echo Could not find Python.
|
||||
exit /b 1
|
||||
Reference in new issue
Block a user