Fix rm path handling (#11064)

# Description
Fixes issue #11061 where `rm` fails to find a file after a `cd`. It
looks like the new glob functions do not return absolute file paths
which we forgot to account for.

# Tests
Added a test (fails on current main, but passes with this PR).

---------

Co-authored-by: Jakub Žádník <kubouch@gmail.com>
This commit is contained in:
Ian Manske
2023-11-16 23:30:15 +00:00
committed by GitHub
parent dbdb1f6600
commit 3966c0a9fd
2 changed files with 19 additions and 2 deletions

View File

@ -250,7 +250,7 @@ fn rm(
Ok(files) => {
for file in files {
match file {
Ok(ref f) => {
Ok(f) => {
if !target_exists {
target_exists = true;
}
@ -263,7 +263,9 @@ fn rm(
continue;
}
all_targets.entry(f.clone()).or_insert_with(|| target.span);
all_targets
.entry(nu_path::expand_path_with(f, &currentdir_path))
.or_insert_with(|| target.span);
}
Err(e) => {
return Err(ShellError::GenericError(