Fix expanding external args (#847)

This commit is contained in:
JT 2022-01-25 08:11:35 -05:00 committed by GitHub
parent f4c0538653
commit 1ca3e03578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -302,10 +302,17 @@ impl<'call> ExternalCommand<'call> {
let mut process = std::process::Command::new(&new_head);
for arg in self.args.iter() {
let arg = Spanned {
let mut arg = Spanned {
item: trim_enclosing_quotes(&arg.item),
span: arg.span,
};
arg.item = if arg.item.starts_with('~') || arg.item.starts_with("..") {
nu_path::expand_path_with(&arg.item, cwd)
.to_string_lossy()
.to_string()
} else {
arg.item
};
let cwd = PathBuf::from(cwd);