diff --git a/dev/breeze/src/airflow_breeze/utils/run_utils.py b/dev/breeze/src/airflow_breeze/utils/run_utils.py index cfd9e9e179cf0..35052f44e07e7 100644 --- a/dev/breeze/src/airflow_breeze/utils/run_utils.py +++ b/dev/breeze/src/airflow_breeze/utils/run_utils.py @@ -412,13 +412,16 @@ def _run_compile_internally( env = os.environ.copy() if dev: - return run_command( - command_to_execute, - check=False, - no_output_dump_on_exception=True, - text=True, - env=env, - ) + with open(UI_ASSET_OUT_DEV_MODE_FILE, "w") as output_file: + return run_command( + command_to_execute, + check=False, + no_output_dump_on_exception=True, + text=True, + env=env, + stderr=subprocess.STDOUT, + stdout=output_file, + ) compile_lock.parent.mkdir(parents=True, exist_ok=True) compile_lock.unlink(missing_ok=True) try: diff --git a/scripts/ci/prek/compile_ui_assets_dev.py b/scripts/ci/prek/compile_ui_assets_dev.py index 8e98a0708f4a4..903e7f5e98d3e 100755 --- a/scripts/ci/prek/compile_ui_assets_dev.py +++ b/scripts/ci/prek/compile_ui_assets_dev.py @@ -18,6 +18,7 @@ from __future__ import annotations import os +import signal import subprocess import sys from pathlib import Path @@ -79,10 +80,9 @@ stderr=subprocess.STDOUT, ) - subprocess.run( + subprocess.Popen( ["pnpm", "dev"], cwd=os.fspath(UI_DIRECTORY), - check=True, env=env, stdout=open(UI_ASSET_OUT_DEV_MODE_FILE, "a"), stderr=subprocess.STDOUT, @@ -104,3 +104,7 @@ stdout=open(SIMPLE_AUTH_MANAGER_UI_ASSET_OUT_DEV_MODE_FILE, "a"), stderr=subprocess.STDOUT, ) + + # Keep script alive so child processes stay in the same process group. + # When breeze exits, kill_process_group() will terminate all processes together. + signal.pause()