Repository navigation
Fix CLI panics on invalid IPs and closed output pipes - #305
Draft
code-inflation wants to merge 5 commits into
Draft
code-inflation wants to merge 5 commits into
code-inflation wants to merge 5 commits into
Conversation
…tdout - Validate --ipv4/--ipv6 values with clap value parsers so invalid addresses produce a usage error with exit code 2 instead of a panic (previously exit 101), and collapse the three duplicate client construction branches in main.rs into one. - Route all stdout writes through new tolerant helpers (src/stdout.rs): a broken pipe (e.g. the consumer of 'cfspeedtest -o json | jq' exiting early) is now tolerated silently instead of panicking with exit 101; unexpected stdout write errors are reported once on stderr. Completion scripts are buffered in memory because clap_complete panics on write errors. - Add regression tests for both behaviors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invalid
--ipv4and--ipv6values now exit 2 with a usage error, including when the address is from the wrong family. HTTP client initialization failures print a diagnostic and exit 1.The CLI keeps the run's exit code when stdout closes in terminal, CSV, and JSON modes. Shell completions also handle a closed pipe. An unexpected stdout write error is reported once on stderr and makes an otherwise successful command exit 1.
The regression tests close the pipe before starting the CLI. The deadline tests hold back response bodies and use the test watchdog, and the HTTP fixtures use blocking reads to avoid a socket race on macOS.
All CI checks passed, including 82 tests and both Docker builds.