fix rm -f when some files not found (#17249)

Fix CI failure after #17237
I don't know how can it happened, but it seems that `rm -f` inside tests
should fix the problem.

## Release notes summary - What our users need to know
NaN

## Tasks after submitting
This commit is contained in:
Wind
2025-12-28 08:29:07 +08:00
committed by GitHub
parent ba5f920af2
commit 3abe388791
3 changed files with 16 additions and 6 deletions
+14 -4
View File
@@ -465,10 +465,20 @@ fn rm(
Ok(None) => {}
Ok(Some(msg)) => eprintln!("{msg}"),
Err(err) => {
if cmd_result.is_ok() {
cmd_result = Err(err);
} else {
report_shell_error(Some(stack), engine_state, &err)
if !(force
&& matches!(
err,
ShellError::Io(IoError {
kind: shell_error::io::ErrorKind::Std(std::io::ErrorKind::NotFound, ..),
..
})
))
{
if cmd_result.is_ok() {
cmd_result = Err(err);
} else {
report_shell_error(Some(stack), engine_state, &err)
}
}
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ def path_add_expand [] {
assert equal (get_path) ([$link_dir])
}
rm $real_dir $link_dir
rm -f $real_dir $link_dir
}
@test
+1 -1
View File
@@ -74,7 +74,7 @@ def path_add_expand [] {
assert equal (get_path) ([$link_dir])
}
do -i { rm $real_dir $link_dir }
rm -f $real_dir $link_dir
}
@test