diff --git a/tools/build_data_stream.cmd b/tools/build_data_stream.cmd index 9eb387bc9..cd39a249d 100644 --- a/tools/build_data_stream.cmd +++ b/tools/build_data_stream.cmd @@ -1,5 +1,6 @@ @echo off setlocal +setlocal enabledelayedexpansion set VS_DEV_CMD_BAT="C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat" if exist %VS_DEV_CMD_BAT% ( @@ -20,10 +21,12 @@ if DEFINED VIRTUAL_ENV ( @REM the 'right' venv is the caller's responsibility) echo "Building in the current venv '%VIRTUAL_ENV'" @call python %BUILD_PY% %* + set RESULT=!ERRORLEVEL! ) else ( @REM Ensure the (default) venv is created, then run build_data_stream.py in it @call %TOOLS_DIR%\ensure_venv.cmd @call %TOOLS_DIR%\venv_exec.cmd python %BUILD_PY% %* + set RESULT=!ERRORLEVEL! ) -EXIT /B %ERRORLEVEL% +EXIT /B !RESULT! diff --git a/tools/py/build_admin_web_app.py b/tools/py/build_admin_web_app.py index 1f59c8e5f..577f395b7 100644 --- a/tools/py/build_admin_web_app.py +++ b/tools/py/build_admin_web_app.py @@ -5,7 +5,6 @@ import os from pathlib import Path from core.file_utils import CWD, SparkPaths, as_absolute_paths, link_dir, rmdir_or_unlink from core.build_step import BuildStep -from core.logging import exec_and_log_error from core.table_formatter import fmt_table import subprocess import argparse @@ -195,4 +194,8 @@ def _main(): if __name__ == '__main__': - exec_and_log_error(_main) + try: + _main() + except Exception as e: + print(f'build_admin_web_app.py failed: {e}') + exit(1) diff --git a/tools/py/build_api_server.py b/tools/py/build_api_server.py index 470516b13..2487f7e22 100644 --- a/tools/py/build_api_server.py +++ b/tools/py/build_api_server.py @@ -121,3 +121,4 @@ if __name__ == "__main__": _main() except Exception as e: print(f'build_api_server.py failed: {e}') + exit(1) diff --git a/tools/py/build_data_stream.py b/tools/py/build_data_stream.py index 377691855..64b3b09cf 100644 --- a/tools/py/build_data_stream.py +++ b/tools/py/build_data_stream.py @@ -126,4 +126,5 @@ if __name__ == "__main__": try: _main() except Exception as e: - print(f'build_data_stream.py failed: {e}') + print(f"build_data_stream.py failed: {e}") + exit(1) diff --git a/tools/py/build_data_stream_query_analyzer.py b/tools/py/build_data_stream_query_analyzer.py index 7c207326b..b4a4eac20 100644 --- a/tools/py/build_data_stream_query_analyzer.py +++ b/tools/py/build_data_stream_query_analyzer.py @@ -116,3 +116,4 @@ if __name__ == "__main__": _main() except Exception as e: print(f"build_data_stream_query_analyzer.py failed: {e}") + exit(1) diff --git a/tools/py/build_data_stream_web_app.py b/tools/py/build_data_stream_web_app.py index 276e340ad..8aba3dfa1 100644 --- a/tools/py/build_data_stream_web_app.py +++ b/tools/py/build_data_stream_web_app.py @@ -114,3 +114,4 @@ if __name__ == "__main__": _main() except Exception as e: print(f"build_data_stream_web_app.py failed: {e}") + exit(1) diff --git a/tools/py/publish_data_stream_web_app.py b/tools/py/publish_data_stream_web_app.py index db727b2a6..bf1ab85a8 100644 --- a/tools/py/publish_data_stream_web_app.py +++ b/tools/py/publish_data_stream_web_app.py @@ -203,4 +203,8 @@ def _main(): if __name__ == '__main__': - _main() + try: + _main() + except Exception as e: + print(f"publish_data_stream_web_app.py failed: {e}") + exit(1) diff --git a/tools/venv_exec.cmd b/tools/venv_exec.cmd index 1678989b4..67da854b6 100644 --- a/tools/venv_exec.cmd +++ b/tools/venv_exec.cmd @@ -4,9 +4,10 @@ set VENV_DIR=%~dp0..\.venv call %VENV_DIR%\Scripts\activate.bat %* +set RESULT=%ERRORLEVEL% call :deactivate goto :EOF :deactivate call %VENV_DIR%\Scripts\deactivate.bat -exit /B %ERRORLEVEL% +exit /B %RESULT%