@@ -174,8 +174,7 @@ goto run
174174if defined noprojgen goto msbuild
175175
176176@ rem Generate the VS project.
177- echo configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG%
178- python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG%
177+ call :run-python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG%
179178if errorlevel 1 goto create-msvs-files-failed
180179if not exist node.sln goto create-msvs-files-failed
181180echo Project files generated.
@@ -340,8 +339,7 @@ if "%config%"=="Debug" set test_args=--mode=debug %test_args%
340339if " %config% " == " Release" set test_args = --mode=release %test_args%
341340echo running 'cctest %cctest_args% '
342341" %config% \cctest" %cctest_args%
343- echo running 'python tools\test.py %test_args% '
344- python tools\test.py %test_args%
342+ call :run-python tools\test.py %test_args%
345343goto jslint
346344
347345:jslint
@@ -377,6 +375,14 @@ echo vcbuild.bat build-release : builds the release distribution as used by n
377375echo vcbuild.bat enable-vtune : builds nodejs with Intel VTune profiling support to profile JavaScript
378376goto exit
379377
378+ :run-python
379+ call tools\msvs\find_python.cmd
380+ if errorlevel 1 echo Could not find python2 & goto :exit
381+ set cmd1 = %VCBUILD_PYTHON_LOCATION% %*
382+ echo %cmd1%
383+ %cmd1%
384+ exit /b %ERRORLEVEL%
385+
380386:exit
381387goto :EOF
382388
@@ -388,8 +394,9 @@ rem ***************
388394set NODE_VERSION =
389395set TAG =
390396set FULLVERSION =
391-
392- for /F " usebackq tokens=*" %%i in (`python " %~dp0 tools\getnodeversion.py" `) do set NODE_VERSION = %%i
397+ :: Call as subroutine for validation of python
398+ call :run-python tools\getnodeversion.py > nul
399+ for /F " tokens=*" %%i in ('%VCBUILD_PYTHON_LOCATION% tools\getnodeversion.py') do set NODE_VERSION = %%i
393400if not defined NODE_VERSION (
394401 echo Cannot determine current version of Node.js
395402 exit /b 1
@@ -398,7 +405,7 @@ if not defined NODE_VERSION (
398405if not defined DISTTYPE set DISTTYPE = release
399406if " %DISTTYPE% " == " release" (
400407 set FULLVERSION = %NODE_VERSION%
401- goto exit
408+ exit /b 0
402409)
403410if " %DISTTYPE% " == " custom" (
404411 if not defined CUSTOMTAG (
@@ -425,7 +432,4 @@ if not "%DISTTYPE%"=="custom" (
425432 set TAG = %DISTTYPE%%DATESTRING%%COMMIT%
426433)
427434set FULLVERSION = %NODE_VERSION% -%TAG%
428-
429- :exit
430- if not defined DISTTYPEDIR set DISTTYPEDIR = %DISTTYPE%
431- goto :EOF
435+ exit /b 0
0 commit comments