mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 22:17:45 +00:00
sort: avoid sigpipe errors
By calling `unwrap` we get a panic instead of an abort, and since we mute sigpipe panics for all utilites, no error message will be printed.
This commit is contained in:
parent
ce6d439a1b
commit
816c55dce4
3 changed files with 20 additions and 7 deletions
|
@ -913,3 +913,16 @@ fn test_merge_batch_size() {
|
|||
.succeeds()
|
||||
.stdout_only_fixture("merge_ints_interleaved.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sigpipe_panic() {
|
||||
let mut cmd = new_ucmd!();
|
||||
let mut child = cmd.args(&["ext_sort.txt"]).run_no_wait();
|
||||
// Dropping the stdout should not lead to an error.
|
||||
// The "Broken pipe" error should be silently ignored.
|
||||
drop(child.stdout.take());
|
||||
assert_eq!(
|
||||
String::from_utf8(child.wait_with_output().unwrap().stderr),
|
||||
Ok(String::new())
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue