Name the loop's states with one transition function, and inject its side effects
This commit is contained in:
@@ -2,12 +2,13 @@ import subprocess
|
||||
|
||||
from loop_claude.claude_code.formats import assistant_parts, ends_stream, parse
|
||||
from loop_claude.claude_code.transcript import part_line
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.outcome import Failure
|
||||
|
||||
|
||||
def run_worker(root, args) -> Failure | None:
|
||||
def run_worker(root, args, effects: Effects) -> Failure | None:
|
||||
try:
|
||||
proc = subprocess.Popen(["claude", *args], cwd=root, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)
|
||||
proc = effects.popen(["claude", *args], cwd=root, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not start claude: {failure.strerror}")
|
||||
with proc:
|
||||
|
||||
Reference in New Issue
Block a user