INNER CODE UNIT · Python
_strip_helper_protocol
WMAL/kodachios · Kodachi-OS-10-stable/open/dock/lib/kodachi_direct.py:701
def _strip_helper_protocol(body):
"""Drop kodachi-repo-apt's startup sentinel from user-visible output.
Line-anchored, so a package name or an apt message that merely CONTAINS
the literal is not silently eaten from the transcript the operator reads.
Only a line that begins with it is protocol.
"""
if HELPER_STARTED not in body:
return body
return "\n".join(line for line in body.split("\n")
if not line.startswith(HELPER_STARTED))
def _terminate(proc):
if getattr(proc, "stdin", None) is not None and getattr(proc.stdin, "closed", False):
proc.stdin = None
try:
os.killpg(proc.pid, signal.SIGTERM)