Fix capturing environment variables with " or ' (#537)

* Fix path expand error span

* Fix capturing env vars containing ' or "; Rustfmt
This commit is contained in:
Jakub Žádník
2021-12-20 23:19:43 +02:00
committed by GitHub
parent 0571a6ee34
commit 1609101e62
3 changed files with 46 additions and 6 deletions

View File

@ -111,11 +111,12 @@ fn expand(path: &Path, span: Span, args: &Arguments) -> Value {
Value::string(p.to_string_lossy(), span)
} else if args.strict {
Value::Error {
error: ShellError::LabeledError(
error: ShellError::SpannedLabeledError(
"Could not expand path".into(),
"could not be expanded (path might not exist, non-final \
component is not a directory, or other cause)"
.into(),
span,
),
}
} else {

View File

@ -251,7 +251,7 @@ pub enum ShellError {
SpannedLabeledErrorHelp(String, String, #[label("{1}")] Span, String),
#[error("{0}")]
#[diagnostic()]
#[diagnostic(help("{1}"))]
LabeledError(String, String),
}