1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

csplit: defer IO read error handling to iterator.

This commit is contained in:
Fuad Ismail 2024-12-12 11:05:39 +07:00 committed by Daniel Hofstetter
parent 1dc463fd26
commit 757c0b260e

View file

@ -582,12 +582,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} else {
let file = File::open(file_name)
.map_err_context(|| format!("cannot access {}", file_name.quote()))?;
let file_metadata = file
.metadata()
.map_err_context(|| format!("cannot access {}", file_name.quote()))?;
if !file_metadata.is_file() {
return Err(CsplitError::NotRegularFile(file_name.to_string()).into());
}
Ok(csplit(&options, &patterns, BufReader::new(file))?)
}
}