MCPcopy Create free account
hub / github.com/1jehuang/jcode / wait_for_socket

Function wait_for_socket

scripts/bench_memory_cli.py:192–204  ·  view source on GitHub ↗
(path: str, timeout_s: float)

Source from the content-addressed store, hash-verified

190
191
192def wait_for_socket(path: str, timeout_s: float) -> bool:
193 deadline = time.time() + timeout_s
194 while time.time() < deadline:
195 if os.path.exists(path):
196 try:
197 sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
198 sock.connect(path)
199 sock.close()
200 return True
201 except OSError:
202 pass
203 time.sleep(0.05)
204 return False
205
206
207def launch_interactive(argv: list[str], cwd: Path, env: dict[str, str], timeout_s: float, settle_s: float) -> SessionLaunch:

Callers 1

run_toolFunction · 0.70

Calls 2

connectMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected