From fdd455bc58b8708eb2c7e3e5d83efca3ec49e4a4 Mon Sep 17 00:00:00 2001 From: subtract0 <205509009+subtract0@users.noreply.github.com> Date: Sat, 16 May 2026 23:09:31 -0700 Subject: [PATCH] fix(gateway): avoid zsh status variable in update wrapper --- gateway/run.py | 6 +++++- tests/gateway/test_update_streaming.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gateway/run.py b/gateway/run.py index 56185190e2..81ce914b8a 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -12837,7 +12837,11 @@ class GatewayRunner: update_cmd = ( f"PYTHONUNBUFFERED=1 {hermes_cmd_str} update --gateway" f" > {shlex.quote(str(output_path))} 2>&1; " - f"status=$?; printf '%s' \"$status\" > {shlex.quote(str(exit_code_path))}" + # Avoid `status=$?`: `status` is a read-only special parameter + # in zsh, and this command string is copied/reused in macOS/zsh + # operator wrappers. Keep the template zsh-safe even though this + # specific subprocess currently runs under bash. + f"rc=$?; printf '%s' \"$rc\" > {shlex.quote(str(exit_code_path))}" ) setsid_bin = shutil.which("setsid") if setsid_bin: diff --git a/tests/gateway/test_update_streaming.py b/tests/gateway/test_update_streaming.py index 932bd1b057..eb0f0cfa89 100644 --- a/tests/gateway/test_update_streaming.py +++ b/tests/gateway/test_update_streaming.py @@ -237,6 +237,8 @@ class TestUpdateCommandGatewayFlag: cmd_string = call_args[-1] if isinstance(call_args, list) else str(call_args) assert "--gateway" in cmd_string assert "PYTHONUNBUFFERED" in cmd_string + assert "rc=$?" in cmd_string + assert "status=$?" not in cmd_string assert "stream progress" in result