🔥 Gremlins MVP: cut unrequested surface per keep/cut calls

This commit is contained in:
2026-10-17 00:12:40 +02:00
parent 82ef04c118
commit e1884248e8
5 changed files with 42 additions and 48 deletions
+4 -4
View File
@@ -6,6 +6,8 @@ import threading
import time
from pathlib import Path
from grm.stream import StreamState
POLL_S = 0.2
READER_JOIN_S = 10.0 # an orphaned grandchild can hold stdout open after claude exits
STOP_SIGNALS = tuple(s for s in (signal.SIGTERM, signal.SIGINT, getattr(signal, "SIGBREAK", None))
@@ -39,11 +41,9 @@ def _read(stdout, raw, ss) -> None:
pass # the raw file or pipe was closed after READER_JOIN_S
def run_claude(argv, prompt: str, env, cwd, raw_path, on_start, ss=None):
def run_claude(argv, prompt: str, env, cwd, raw_path, on_start):
"""Run one call to its end. Returns (ss, exit_code, stopped)."""
if ss is None:
from grm.stream import StreamState
ss = StreamState()
ss = StreamState()
raw_path = Path(raw_path)
with open(raw_path, "wb") as raw, open(raw_path.with_suffix(".err"), "wb") as err:
child = subprocess.Popen(argv, cwd=cwd, env=env, stdin=subprocess.PIPE,