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
)
| 160 | |
| 161 | |
| 162 | def 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 | |
| 184 | def start_mdm_raw_read() -> PrefetchHandle: |