Browse Source

Issue 2341 – Source code package build script exits parent cmd console on error

https://winscp.net/tracker/2341

Source commit: 4d04772482a17735380ac2a3425e95ab67b4996f
Martin Prikryl 9 months ago
parent
commit
be95f252b8
2 changed files with 10 additions and 9 deletions
  1. 3 2
      build.bat
  2. 7 7
      libs/buildlibs.bat

+ 3 - 2
build.bat

@@ -9,7 +9,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
   set "PROGRAMFILES64=%ProgramFiles%"
 ) else (
   echo Unrecognized architecture %PROCESSOR_ARCHITECTURE%
-  exit
+  exit /B 1
 )
 
 set BDS=%PROGRAMFILES32%\Embarcadero\Studio\22.0
@@ -21,7 +21,7 @@ set MSBUILD_COMMUNITY=%PROGRAMFILES64%\%VS_PATH_REL%\Community\%MSBUILD_REL%
 set MSBUILD=%MSBUILD_COMMUNITY%
 rem Visual Studio 2022 Build Tools (build server)
 if not exist "%MSBUILD%" set MSBUILD=%PROGRAMFILES32%\%VS_PATH_REL%\BuildTools\%MSBUILD_REL%
-if not exist "%MSBUILD%" echo Cannot find MSBUILD (%MSBUILD%, %MSBUILD_COMMUNITY%), install Build Tools for Visual Studio 2022 & exit
+if not exist "%MSBUILD%" echo Cannot find MSBUILD (%MSBUILD%, %MSBUILD_COMMUNITY%), install Build Tools for Visual Studio 2022 & exit /B 1
 
 set WITH_DOTNET=1
 if "%BUILD_TARGET%"=="" set BUILD_TARGET=Build
@@ -32,6 +32,7 @@ set BUILDTOOLS=%~dp0\buildtools
 cd libs
 set INTERM_PATH=%~dp0\source
 call buildlibs.bat
+if errorlevel 1 echo Error building libs & exit /B 1
 set INTERM_PATH=
 
 cd ..\source

+ 7 - 7
libs/buildlibs.bat

@@ -1,5 +1,5 @@
 @echo off
-if "%BUILDTOOLS%" == "" echo BUILDTOOLS not set & exit
+if "%BUILDTOOLS%" == "" echo BUILDTOOLS not set & exit /B 1
 
 set LIB_PATH=%INTERM_PATH%\Win32
 
@@ -19,7 +19,7 @@ cd ..
 
 if not exist %LIB_PATH%\libeay32.lib (
 echo OpenSSL build failed
-exit 1
+exit /B 1
 )
 
 :SKIP_OPENSSL
@@ -38,7 +38,7 @@ cd ..\..
 
 if not exist expat\bcb5\release\libexpats_mtd.lib (
 echo Expat build failed
-exit 1
+exit /B 1
 )
 
 copy expat\bcb5\release\libexpats_mtd.lib %LIB_PATH%
@@ -59,7 +59,7 @@ cd ..
 
 if not exist %LIB_PATH%\neon.lib (
 echo neon build failed
-exit 1
+exit /B 1
 )
 
 :SKIP_NEON
@@ -78,7 +78,7 @@ cd ..
 
 if not exist %LIB_PATH%\PuTTYVS.lib (
 echo PuTTYVS build failed
-exit 1
+exit /B 1
 )
 
 :SKIP_PUTTYVS
@@ -97,7 +97,7 @@ cd ..
 
 if not exist %LIB_PATH%\libs3.lib (
 echo libs3 build failed
-exit 1
+exit /B 1
 )
 
 :SKIP_LIBS3
@@ -116,7 +116,7 @@ cd ..\..
 
 if not exist %LIB_PATH%\UafxcW.lib (
 echo MFC build failed
-exit 1
+exit /B 1
 )
 
 :SKIP_MFC