Skip to content

Commit

Permalink
fix(mv): attempt to fix windows ci
Browse files Browse the repository at this point in the history
  • Loading branch information
PThorpe92 committed Oct 1, 2023
1 parent 6cdab9a commit 0918434
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/uu/mv/src/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use uucore::backup_control::{self, source_is_target_backup, BackupMode};
use uucore::display::Quotable;
use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError};
use uucore::fs::{are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file};
use uucore::libc;
#[cfg(unix)]
use uucore::libc::{EDQUOT, EEXIST, EISDIR, EMLINK, ENOSPC, ENOTEMPTY, ETXTBSY};
use uucore::update_control::{self, UpdateMode};
use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show};

Expand Down Expand Up @@ -402,8 +402,15 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR
Err(e) if e.to_string().is_empty() => set_exit_code(1),
Err(e) => {
match e.raw_os_error() {
#[cfg(unix)]
Some(ENOTEMPTY | EEXIST | EDQUOT | EISDIR | ENOSPC | EMLINK | ETXTBSY) => {
Some(
libc::ENOTEMPTY
| libc::EEXIST
| libc::EDQUOT
| libc::EISDIR
| libc::ENOSPC
| libc::EMLINK
| libc::ETXTBSY,
) => {
// The error message was changed to match GNU's decision
// when an issue was filed. These will match when merged upstream.
let e = e
Expand Down Expand Up @@ -498,7 +505,7 @@ fn rename(
} else {
// TODO: change when 'io::Error::DirectoryNotEmpty' is stabilized.
// https://github.com/rust-lang/rust/issues/86442
return Err(io::Error::from_raw_os_error(ENOTEMPTY));
return Err(io::Error::from_raw_os_error(libc::ENOTEMPTY));
}
}
}
Expand Down

0 comments on commit 0918434

Please sign in to comment.