Skip to content

Commit 4153088

Browse files
sgmarzChrisDryden
authored andcommitted
install: update error messages and remove the additional Rust errorisms (e.g., (os error 13)) by using UIoError to print the error message.
1 parent f176a67 commit 4153088

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/uu/install/src/install.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use uucore::selinux::{
3535
};
3636
use uucore::translate;
3737
use uucore::{format_usage, show, show_error, show_if_err};
38+
use uucore::error::UIoError;
3839

3940
#[cfg(unix)]
4041
use std::os::unix::fs::MetadataExt;
@@ -843,7 +844,8 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> {
843844
// see if the file exists, and it can't even be checked, this means we
844845
// don't have permission to access the file, so we should return an error.
845846
if let Err(to_stat) = to.try_exists() {
846-
return Err(InstallError::CannotStat(to.to_path_buf(), to_stat.to_string()).into());
847+
let err = UIoError::from(to_stat);
848+
return Err(InstallError::CannotStat(to.to_path_buf(), err.to_string()).into());
847849
}
848850

849851
if to.is_dir() && !from.is_dir() {
@@ -862,7 +864,8 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> {
862864
// If we get here, then remove_file failed for some
863865
// reason other than the file not existing. This means
864866
// this should be a fatal error, not a warning.
865-
return Err(InstallError::FailedToRemove(to.to_path_buf(), e.to_string()).into());
867+
let err = UIoError::from(e);
868+
return Err(InstallError::FailedToRemove(to.to_path_buf(), err.to_string()).into());
866869
}
867870
}
868871

0 commit comments

Comments
 (0)