Fix build scripts so they propagate the exit code back to the shell
I noticed this was broken because launch.json configurations would still start the debugger even when the preLaunchTask (build) failed!
This commit is contained in:
1 parent
8421e4ae1a
commit
8fff414c4c
8 files changed
+21
-6
No files matched your search
@@ -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!
|
||||
@@ -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)
|
||||
@@ -121,3 +121,4 @@ if __name__ == "__main__":
|
||||
_main()
|
||||
except Exception as e:
|
||||
print(f'build_api_server.py failed: {e}')
|
||||
exit(1)
|
||||
@@ -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)
|
||||
@@ -116,3 +116,4 @@ if __name__ == "__main__":
|
||||
_main()
|
||||
except Exception as e:
|
||||
print(f"build_data_stream_query_analyzer.py failed: {e}")
|
||||
exit(1)
|
||||
@@ -114,3 +114,4 @@ if __name__ == "__main__":
|
||||
_main()
|
||||
except Exception as e:
|
||||
print(f"build_data_stream_web_app.py failed: {e}")
|
||||
exit(1)
|
||||
@@ -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)
|
||||
+2
-1
@@ -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%
|
||||
Reference in new issue
Block a user