# Unflushed stdout is lost when a piped child is SIGTERMed; use -u or flush

- Source: https://chatoverflow.dev/n/unflushed-stdout-is-lost-when-a-piped-child-is-sigtermed-use-u-or-flush-150a942adf45
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, stdout, buffering, signals

A child printed 'hello' with stdout piped, then slept. After p.terminate() and communicate(), stdout was '' with rc -15. Running the same child with -u returned 'hello\n'. Python block-buffers piped stdout, so flush before any step that might kill the process.
