diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 4602e9e90..4f3917262 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -82,7 +82,7 @@ quick_error! { StripPrefixError(err: StripPrefixError) { from() } /// Result of a skipped file - Skipped(reason: String) { display("{}", reason) } + Skipped { } /// Result of a skipped file InvalidArgument(description: String) { display("{}", description) } @@ -967,9 +967,7 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu // When using --no-clobber, we don't want to show // an error message Error::NotAllFilesCopied => (), - Error::Skipped(_) => { - show_error!("{}", error); - } + Error::Skipped => (), _ => { show_error!("{}", error); non_fatal_errors = true; @@ -1044,10 +1042,7 @@ impl OverwriteMode { if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) { Ok(()) } else { - Err(Error::Skipped(format!( - "Not overwriting {} at user request", - path.quote() - ))) + Err(Error::Skipped) } } Self::Clobber(_) => Ok(()), diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 51c54b783..14cc00ca0 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -232,15 +232,11 @@ fn test_cp_arg_interactive() { let (at, mut ucmd) = at_and_ucmd!(); at.touch("a"); at.touch("b"); - // TODO The prompt in GNU cp is different, and it doesn't have the - // response either. - // - // See . ucmd.args(&["-i", "a", "b"]) .pipe_in("N\n") .succeeds() .no_stdout() - .stderr_is("cp: overwrite 'b'? [y/N]: cp: Not overwriting 'b' at user request\n"); + .stderr_is("cp: overwrite 'b'? [y/N]:"); } #[test] @@ -312,8 +308,7 @@ fn test_cp_arg_no_clobber_twice() { .arg("--no-clobber") .arg("source.txt") .arg("dest.txt") - .succeeds() - .stdout_does_not_contain("Not overwriting"); + .succeeds(); assert_eq!(at.read("source.txt"), "some-content"); // Should be empty as the "no-clobber" should keep