Skip to content

fix: swallow BrokenPipeError in Printer.write - #260

Open
r3wretrhy wants to merge 1 commit into
nickstenning:mainfrom
r3wretrhy:fix/printer-broken-pipe-255
Open

r3wretrhy wants to merge 1 commit into
nickstenning:mainfrom
r3wretrhy:fix/printer-broken-pipe-255

Conversation

@r3wretrhy

Copy link
Copy Markdown

Summary

When honcho's stdout is piped and the consumer exits early (e.g. honcho start | head / | tee then Ctrl-C), Printer.write raises BrokenPipeError from print() and aborts the manager loop before child processes are terminated. That can leave children running and subsequent restarts fail with address already in use.

Catch BrokenPipeError in Printer.write and return so shutdown can proceed, matching the approach suggested in #255 / the Python SIGPIPE note.

Fixes #255.

Test plan

  • pytest tests/test_printer.py — 16 passed (includes new test_write_broken_pipe_is_swallowed)

When honcho's stdout is piped and the consumer exits early, print()
raises BrokenPipeError and aborts the manager loop before child
processes are terminated. Catch it so shutdown can proceed.

Fixes nickstenning#255

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Printer / Manager doesn't handle BrokenPipeError on write if the output is piped

1 participant