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.
We have a number of CLI tools that panic when piped to things like
head
instead of quietly exiting. There's a long history about this within the Rust
community (see rust-lang/rust#62569), but the long
and short of it is that SIGPIPE really should be set to its default handler
(
SIG_DFL
, terminate the process) for CLI tools.Because oxlog doesn't make any network requests, reset the SIGPIPE handler to
SIG_DFL
.I looked at also potentially doing this for some of our other CLI tools that
wait on network services. This should be fine to do if and only if whenever we
send data over a socket, the
MSG_NOSIGNAL
flag is set. (This causes anEPIPE
error to be returned, but noSIGPIPE
signal to be generated.)Rust does set this flag here. However, as of Rust 1.77 this flag is not
set on illumos. That's a bug and I'll fix it in Rust upstream.