IO error just skips topdir check instead of failing entire operation
This commit is contained in:
parent
f76f21ffc2
commit
f43568de81
1 changed files with 11 additions and 4 deletions
|
@ -98,7 +98,7 @@ pub fn put(options: PutOptions) -> Result<()> {
|
|||
// println!("Strategy: {:?}", strategy);
|
||||
|
||||
if options.dry {
|
||||
eprintln!("Dry-deleting: {}", path.to_str().unwrap());
|
||||
eprintln!("Dry-deleting {:?} with strategy {:?}", path, strategy);
|
||||
} else if let Err(err) = strategy.delete(path, &options) {
|
||||
eprintln!("{}", err);
|
||||
}
|
||||
|
@ -140,12 +140,19 @@ impl DeletionStrategy {
|
|||
}
|
||||
|
||||
// try to use the $topdir/.Trash directory
|
||||
if should_use_topdir_trash(&target_mount) {
|
||||
// NOTE: really wish i could break from if statements...
|
||||
'topdir: while should_use_topdir_trash(&target_mount) {
|
||||
let topdir_trash_dir = target_mount
|
||||
.join(".Trash")
|
||||
.join(utils::get_uid().to_string());
|
||||
let trash_dir = TrashDir::from(topdir_trash_dir);
|
||||
trash_dir.create()?;
|
||||
let trash_dir = TrashDir::from(&topdir_trash_dir);
|
||||
match trash_dir.create() {
|
||||
Ok(_) => (),
|
||||
Err(err) => {
|
||||
info!("Not deleting {:?} in mount's trash-dir {:?} because of IO error: {:?}", target, topdir_trash_dir, err);
|
||||
break 'topdir;
|
||||
}
|
||||
}
|
||||
return Ok(DeletionStrategy::MoveTo(trash_dir));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue