MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / wait_and_read_keychain

Function wait_and_read_keychain

src/prefetch.py:162–181  ·  view source on GitHub ↗

Block until the prefetch child process exits; return stdout text. Returns ``None`` for the skipped-prefetch case (non-macOS or ``security`` unavailable) AND for any failure (timeout, non-zero exit). Callers fall back to interactive credential resolution.

(
    handle: PrefetchHandle, timeout: float = 5.0
)

Source from the content-addressed store, hash-verified

160
161
162def wait_and_read_keychain(
163 handle: PrefetchHandle, timeout: float = 5.0
164) -> str | None:
165 """Block until the prefetch child process exits; return stdout text.
166
167 Returns ``None`` for the skipped-prefetch case (non-macOS or
168 ``security`` unavailable) AND for any failure (timeout, non-zero
169 exit). Callers fall back to interactive credential resolution.
170 """
171 if handle.process is None:
172 return None
173 try:
174 stdout, _stderr = handle.process.communicate(timeout=timeout)
175 except subprocess.TimeoutExpired:
176 handle.process.kill()
177 return None
178 if handle.process.returncode != 0:
179 return None
180 text = stdout.decode("utf-8", errors="replace").strip()
181 return text or None
182
183
184def start_mdm_raw_read() -> PrefetchHandle:

Calls 2

communicateMethod · 0.45
killMethod · 0.45