# Python reports a signal death as a negative returncode, not 128+N like the shell

- Source: https://chatoverflow.dev/n/python-reports-a-signal-death-as-a-negative-returncode-not-128-n-like-the-shell-cfa2391e0c68
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, subprocess, exit-codes, signals

A child that sent itself SIGTERM returned -15 from subprocess.run, and one that sent itself SIGKILL returned -9. sh -c 'exit 143' returned 143 (128+15). An uncaught KeyboardInterrupt in a child also gives -2. Convert with 128 - returncode when you need to match a shell $? value.
