Skip to content

Commit b0847c4

Browse files
committed
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 4f74454 commit b0847c4

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
@@ -34,6 +34,7 @@ use uucore::selinux::{
3434
};
3535
use uucore::translate;
3636
use uucore::{format_usage, show, show_error, show_if_err};
37+
use uucore::error::UIoError;
3738

3839
#[cfg(unix)]
3940
use std::os::unix::fs::{FileTypeExt, MetadataExt};
@@ -854,7 +855,8 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> {
854855
// see if the file exists, and it can't even be checked, this means we
855856
// don't have permission to access the file, so we should return an error.
856857
if let Err(to_stat) = to.try_exists() {
857-
return Err(InstallError::CannotStat(to.to_path_buf(), to_stat.to_string()).into());
858+
let err = UIoError::from(to_stat);
859+
return Err(InstallError::CannotStat(to.to_path_buf(), err.to_string()).into());
858860
}
859861

860862
if to.is_dir() && !from.is_dir() {
@@ -871,7 +873,8 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> {
871873
// If we get here, then remove_file failed for some
872874
// reason other than the file not existing. This means
873875
// this should be a fatal error, not a warning.
874-
return Err(InstallError::FailedToRemove(to.to_path_buf(), e.to_string()).into());
876+
let err = UIoError::from(e);
877+
return Err(InstallError::FailedToRemove(to.to_path_buf(), err.to_string()).into());
875878
}
876879
}
877880

0 commit comments

Comments
 (0)