(child: Callable[[], NoReturn] | None = None)
| 28 | |
| 29 | |
| 30 | def fork_process(child: Callable[[], NoReturn] | None = None) -> int: # pragma: win32 no cover |
| 31 | if _FORK is None: # pragma: no cover - platform without os.fork |
| 32 | msg = "os.fork is unavailable" |
| 33 | raise RuntimeError(msg) |
| 34 | child_pid = _FORK() |
| 35 | if child_pid == 0 and child is not None: # pragma: win32 no cover |
| 36 | child() # pragma: no cover - child coverage starts after fork returns to this frame |
| 37 | return child_pid |
| 38 | |
| 39 | |
| 40 | def exit_child(status: int) -> NoReturn: |
no outgoing calls