Files
openswarm/backend/apps/subscriptions/NineRouter/NineRouterProcess/helpers/forward_output.py
T

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