1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Modified code to replace all instances of -

Now all instances of `-` will be replaced with real / canonicalized
path of `/dev/stdin`
This commit is contained in:
Kartik Sharma 2022-03-23 20:05:20 +05:30
parent 71a6ae1443
commit 193899f09c

View file

@ -477,11 +477,17 @@ impl Stater {
.unwrap_or_default();
#[cfg(unix)]
if files.contains(&String::from("-")) {
files = Vec::from([Path::new("/dev/stdin")
.canonicalize()?
let redirected_path = Path::new("/dev/stdin")
.canonicalize()
.expect("unable to canonicalize /dev/stdin")
.into_os_string()
.into_string()
.unwrap()]);
.unwrap();
for file in &mut files {
if file == "-" {
*file = redirected_path.clone();
}
}
}
let format_str = if matches.is_present(options::PRINTF) {
matches