fix(agent): give ansible a blocking stdin boundary
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m11s
CD Pipeline / build-and-deploy (push) Successful in 7m1s
CD Pipeline / post-deploy-checks (push) Successful in 2m21s

This commit is contained in:
ogt
2026-07-14 09:11:14 +08:00
parent f550eb33ee
commit 968bd794d1
2 changed files with 2 additions and 0 deletions

View File

@@ -623,6 +623,7 @@ async def _run_ansible_command(spec: AnsibleCommandSpec, *, timeout_seconds: int
*spec.command,
cwd=str(spec.cwd),
env=spec.env,
stdin=asyncio.subprocess.DEVNULL,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)

View File

@@ -2660,6 +2660,7 @@ async def test_controlled_apply_duplicate_never_runs_subprocess(
def test_ansible_subprocess_is_terminated_when_worker_task_is_cancelled() -> None:
source = inspect.getsource(_run_ansible_command)
assert "stdin=asyncio.subprocess.DEVNULL" in source
assert "except asyncio.CancelledError" in source
assert "process.kill()" in source
assert "await process.communicate()" in source