mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-18 15:48:04 +02:00
19 lines
442 B
Python
19 lines
442 B
Python
from typeguard import typechecked
|
|
|
|
|
|
# TODO: type spec this entirely
|
|
@typechecked
|
|
def forward_output(pipe) -> None:
|
|
try:
|
|
for line in iter(pipe.readline, b""):
|
|
text = line.decode("utf-8", errors="replace").rstrip()
|
|
if text:
|
|
print(f"[9router] {text}", flush=True)
|
|
except Exception:
|
|
pass
|
|
finally:
|
|
try:
|
|
pipe.close()
|
|
except Exception:
|
|
pass
|