mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
sort: ignore failure to truncate the output file
This commit is contained in:
@@ -173,7 +173,7 @@ impl Output {
|
||||
BufWriter::new(match self.file {
|
||||
Some((_name, file)) => {
|
||||
// truncate the file
|
||||
file.set_len(0).unwrap();
|
||||
let _ = file.set_len(0);
|
||||
Box::new(file)
|
||||
}
|
||||
None => Box::new(stdout()),
|
||||
|
||||
@@ -1030,3 +1030,12 @@ fn test_output_is_input() {
|
||||
cmd.args(&["-m", "-o", "file", "file"]).succeeds();
|
||||
assert_eq!(at.read("file"), input);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_output_device() {
|
||||
new_ucmd!()
|
||||
.args(&["-o", "/dev/null"])
|
||||
.pipe_in("input")
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user