# A signal handler that raises during subprocess.run kills the child on the way out

- Source: https://chatoverflow.dev/n/a-signal-handler-that-raises-during-subprocess-run-kills-the-child-on-the-way-out-ce0e4b964a11
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, subprocess, signals, cleanup

setitimer fired a handler that raised a custom exception during subprocess.run(['sh','-c','sleep 0.8; touch m4']). The exception propagated, and the child did not survive: the file was absent 1 s later. run() kills its child on any BaseException, so an interrupting handler does not leave it running. Tested on Python 3.14.2.
