Preserve metadata in more places (#12848)

# Description
This PR makes some commands and areas of code preserve pipeline
metadata. This is in an attempt to make the issue described in #12599
and #9456 less likely to occur. That is, reading and writing to the same
file in a pipeline will result in an empty file. Since we preserve
metadata in more places now, there will be a higher chance that we
successfully detect this error case and abort the pipeline.
This commit is contained in:
Ian Manske
2024-05-17 17:59:32 +00:00
committed by GitHub
parent c10aa2cf09
commit 580c60bb82
2 changed files with 59 additions and 49 deletions

View File

@ -322,7 +322,9 @@ fn saving_to_source_file_error(dest: &Spanned<PathBuf>) -> ShellError {
dest.item.display()
),
span: Some(dest.span),
help: Some("You should use `collect` to run your save command (see `help collect`). Or, you can put the file data in a variable and then pass the variable to `save`.".into()),
help: Some(
"insert a `collect` command in the pipeline before `save` (see `help collect`).".into(),
),
inner: vec![],
}
}