MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / drain

Function drain

tests/test_coverage_children.py:57–79  ·  view source on GitHub ↗
(pipe, destination, state, stop)

Source from the content-addressed store, hash-verified

55
56
57def drain(pipe, destination, state, stop):
58 try:
59 with destination.open("xb", buffering=0) as stream:
60 while True:
61 data = pipe.read(4096)
62 if not data:
63 break
64 state["seen"] += len(data)
65 part = memoryview(data)[:max(0, LOG_CAP - state["saved"])]
66 while part:
67 size = stream.write(part)
68 if not size:
69 raise OSError("short evidence write")
70 state["saved"] += size
71 part = part[size:]
72 if state["seen"] > LOG_CAP:
73 state["overflow"] = True
74 stop.set()
75 except (OSError, ValueError) as exc:
76 state["error"] = str(exc)
77 stop.set()
78 finally:
79 pipe.close()
80
81
82def group_exists(pid):

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
openMethod · 0.80
readMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected