mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2026-01-18 11:11:10 +00:00
Merge pull request #4630 from sylvestre/inter-error
Adjust -i behavior for ln, cp & mv
This commit is contained in:
commit
ef601fac98
6 changed files with 35 additions and 7 deletions
|
|
@ -78,6 +78,7 @@ quick_error! {
|
|||
StripPrefixError(err: StripPrefixError) { from() }
|
||||
|
||||
/// Result of a skipped file
|
||||
/// Currently happens when "no" is selected in interactive mode
|
||||
Skipped { }
|
||||
|
||||
/// Result of a skipped file
|
||||
|
|
@ -1018,7 +1019,11 @@ fn show_error_if_needed(error: &Error) -> bool {
|
|||
// When using --no-clobber, we don't want to show
|
||||
// an error message
|
||||
Error::NotAllFilesCopied => (),
|
||||
Error::Skipped => (),
|
||||
Error::Skipped => {
|
||||
// touch a b && echo "n"|cp -i a b && echo $?
|
||||
// should return an error from GNU 9.2
|
||||
return true;
|
||||
}
|
||||
_ => {
|
||||
show_error!("{}", error);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -391,8 +391,8 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
|
|||
match settings.overwrite {
|
||||
OverwriteMode::NoClobber => {}
|
||||
OverwriteMode::Interactive => {
|
||||
if !prompt_yes!("overwrite {}?", dst.quote()) {
|
||||
return Ok(());
|
||||
if !prompt_yes!("replace {}?", dst.quote()) {
|
||||
return Err(LnError::SomeLinksFailed.into());
|
||||
}
|
||||
|
||||
if fs::remove_file(dst).is_ok() {};
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ fn rename(
|
|||
OverwriteMode::NoClobber => return Ok(()),
|
||||
OverwriteMode::Interactive => {
|
||||
if !prompt_yes!("overwrite {}?", to.quote()) {
|
||||
return Ok(());
|
||||
return Err(io::Error::new(io::ErrorKind::Other, ""));
|
||||
}
|
||||
}
|
||||
OverwriteMode::Force => {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue