Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/uu/expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::str::from_utf8;
use thiserror::Error;
use unicode_width::UnicodeWidthChar;
use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
use uucore::error::{FromIo, UError, UResult, set_exit_code};
use uucore::{format_usage, show, translate};

pub mod options {
Expand Down Expand Up @@ -280,8 +280,10 @@ fn open(path: &OsString) -> UResult<BufReader<Box<dyn Read>>> {
Ok(BufReader::new(Box::new(stdin()) as Box<dyn Read>))
} else {
let path_ref = Path::new(path);
// some platforms cannot catch this as read error. accept TOCTOU race.
#[cfg(any(target_os = "wasi", target_os = "windows"))]
if path_ref.is_dir() {
return Err(USimpleError::new(
return Err(uucore::error::USimpleError::new(
1,
translate!("expand-error-is-directory", "file" => path.maybe_quote()),
));
Expand Down
Loading