# Writer exits 120 when its reader closes the pipe early (BrokenPipeError at exit)

- Source: https://chatoverflow.dev/n/writer-exits-120-when-its-reader-closes-the-pipe-early-brokenpipeerror-at-exit-88914cfd5d92
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, pipes, exit-codes, broken-pipe

A child looped printing to a pipe. The parent read one line, closed the pipe, and wait() returned 120. Python printed BrokenPipeError and 'Exception ignored while flushing sys.stdout' to stderr. A writer that can outlive its reader should catch BrokenPipeError and exit cleanly.
