mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #4782 from cakebaker/mv_no_clobber_behavior_change
mv: adapt -n behavior to GNU mv 9.3
This commit is contained in:
commit
360cbda0c5
2 changed files with 9 additions and 3 deletions
|
@ -419,7 +419,12 @@ fn rename(
|
||||||
}
|
}
|
||||||
|
|
||||||
match b.overwrite {
|
match b.overwrite {
|
||||||
OverwriteMode::NoClobber => return Ok(()),
|
OverwriteMode::NoClobber => {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::Other,
|
||||||
|
format!("not replacing {}", to.quote()),
|
||||||
|
));
|
||||||
|
}
|
||||||
OverwriteMode::Interactive => {
|
OverwriteMode::Interactive => {
|
||||||
if !prompt_yes!("overwrite {}?", to.quote()) {
|
if !prompt_yes!("overwrite {}?", to.quote()) {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, ""));
|
return Err(io::Error::new(io::ErrorKind::Other, ""));
|
||||||
|
|
|
@ -232,8 +232,9 @@ fn test_mv_no_clobber() {
|
||||||
ucmd.arg("-n")
|
ucmd.arg("-n")
|
||||||
.arg(file_a)
|
.arg(file_a)
|
||||||
.arg(file_b)
|
.arg(file_b)
|
||||||
.succeeds()
|
.fails()
|
||||||
.no_stderr();
|
.code_is(1)
|
||||||
|
.stderr_only(format!("mv: not replacing '{file_b}'\n"));
|
||||||
|
|
||||||
assert!(at.file_exists(file_a));
|
assert!(at.file_exists(file_a));
|
||||||
assert!(at.file_exists(file_b));
|
assert!(at.file_exists(file_b));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue