MCPcopy Create free account
hub / github.com/tox-dev/filelock / fork_process

Function fork_process

tests/fork_helpers.py:31–43  ·  view source on GitHub ↗
(child: Callable[[], NoReturn])

Source from the content-addressed store, hash-verified

29
30
31def fork_process(child: Callable[[], NoReturn]) -> int: # pragma: win32 no cover
32 if _FORK is None: # pragma: no cover - platform without os.fork
33 msg = "os.fork is unavailable"
34 raise RuntimeError(msg)
35 child_pid = _FORK()
36 if child_pid == 0: # pragma: forked child
37 # A child that raises or returns must never resume the parent's test run.
38 try:
39 child()
40 except BaseException:
41 traceback.print_exc()
42 exit_child(70)
43 return child_pid
44
45
46def exit_child(status: int) -> NoReturn:

Calls 2

exit_childFunction · 0.85
childFunction · 0.50