This commit is contained in:
Timothy Jaeryang Baek
2026-08-05 01:59:39 -05:00
Unverified
parent 034f35bcb9
commit 1516924e99
4 changed files with 42 additions and 10 deletions
+6 -2
View File
@@ -188,8 +188,12 @@ class AcpClient:
async def _stderr_loop(self) -> None:
assert self.proc is not None and self.proc.stderr is not None
while await self.proc.stderr.readline():
pass
while True:
try:
if not await self.proc.stderr.readline():
break
except ValueError:
continue
async def _handle_message(self, message: dict[str, Any]) -> None:
if (
+15 -4
View File
@@ -190,10 +190,21 @@ class CodexAppServer:
async def _stderr_loop(self) -> None:
assert self.proc is not None and self.proc.stderr is not None
while line := await self.proc.stderr.readline():
text = line.decode(errors="replace").strip()
if text:
self.stderr_tail.append(text[:2000])
while True:
try:
line = await self.proc.stderr.readline()
except ValueError as exc:
self._append_stderr(f"stderr line too long: {exc}", truncated=True)
continue
if not line:
break
self._append_stderr(line.decode(errors="replace"))
def _append_stderr(self, text: str, *, truncated: bool = False) -> None:
text = text.strip()
if text:
suffix = " [truncated]" if truncated else ""
self.stderr_tail.append(f"{text[:2000]}{suffix}")
def _fail_pending(self, message: str) -> None:
for future in self.pending.values():
+6 -2
View File
@@ -108,8 +108,12 @@ async def _opencode_server(profile: dict[str, Any], workspace: str):
async def _drain_stderr(proc: asyncio.subprocess.Process) -> None:
assert proc.stderr is not None
while await proc.stderr.readline():
pass
while True:
try:
if not await proc.stderr.readline():
break
except ValueError:
continue
def _headers(profile: dict[str, Any]) -> dict[str, str]:
+15 -2
View File
@@ -223,8 +223,21 @@ class PiRpcClient:
async def _read_stderr(self) -> None:
assert self.proc and self.proc.stderr
while line := await self.proc.stderr.readline():
self.stderr_tail.append(line.decode(errors="replace").rstrip())
while True:
try:
line = await self.proc.stderr.readline()
except ValueError as exc:
self._append_stderr(f"stderr line too long: {exc}", truncated=True)
continue
if not line:
break
self._append_stderr(line.decode(errors="replace"))
def _append_stderr(self, text: str, *, truncated: bool = False) -> None:
text = text.strip()
if text:
suffix = " [truncated]" if truncated else ""
self.stderr_tail.append(f"{text[:2000]}{suffix}")
def _fail_pending(self, message: str) -> None:
for future in self.pending.values():