fix(cli): fail closed on empty oneshot responses

This commit is contained in:
Brian LaFlamme
2026-05-30 07:31:48 -07:00
committed by Teknium
parent 92ad7cc62c
commit 9fbde54b51
2 changed files with 33 additions and 5 deletions
+9 -5
View File
@@ -191,11 +191,15 @@ def run_oneshot(
except Exception:
pass
if response:
real_stdout.write(response)
if not response.endswith("\n"):
real_stdout.write("\n")
real_stdout.flush()
if not (response or "").strip():
sys.stderr.write("hermes -z: no final response was produced; treating the run as failed.\n")
sys.stderr.flush()
return 1
real_stdout.write(response)
if not response.endswith("\n"):
real_stdout.write("\n")
real_stdout.flush()
return 0