MCPcopy Index your code
hub / github.com/python/cpython / kill_on_error

Function kill_on_error

Lib/test/_test_eintr.py:36–43  ·  view source on GitHub ↗

Context manager killing the subprocess if a Python exception is raised.

(proc)

Source from the content-addressed store, hash-verified

34
35@contextlib.contextmanager
36def kill_on_error(proc):
37 """Context manager killing the subprocess if a Python exception is raised."""
38 with proc:
39 try:
40 yield proc
41 except:
42 proc.kill()
43 raise
44
45
46@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")

Callers 8

_interrupted_readsMethod · 0.70
test_writeMethod · 0.70
_test_recvMethod · 0.70
_test_sendMethod · 0.70
test_acceptMethod · 0.70
_test_openMethod · 0.70
check_sigwaitMethod · 0.70
_lockMethod · 0.70

Calls 1

killMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…