Skip to content

Conversation

@pranlawate
Copy link

Fixes BrokenPipeError that occurs when radon output is piped to commands that truncate output (head, less, etc.). This is a common workflow issue that prevents radon from being used in shell pipelines.
I often use head/less with most of the tools so the output doesn't overflow out of my control on terminal. Then needing to scroll back up. So I fixed it locally and thought this fix could help others like me so pushing PR.

  • Add signal.signal(signal.SIGPIPE, signal.SIG_DFL) to CLI initialization
  • Enables clean exit when pipe consumer terminates early
  • No impact on normal output behavior
  • Follows standard Unix pipe handling conventions

Resolves: Broken pipe errors in terminal workflows
Tested: All radon commands (cc, raw, mi, hal) work correctly with pipes

Fixes BrokenPipeError that occurs when radon output is piped to commands
that truncate output (head, less, etc.). This is a common workflow issue
that prevents radon from being used in shell pipelines.

- Add signal.signal(signal.SIGPIPE, signal.SIG_DFL) to CLI initialization
- Enables clean exit when pipe consumer terminates early
- No impact on normal output behavior
- Follows standard Unix pipe handling conventions

Resolves: Broken pipe errors in terminal workflows
Tested: All radon commands (cc, raw, mi, hal) work correctly with pipes
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.

1 participant