From 1ca3e03578c159a76473944b78270b8b9cae21a4 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Tue, 25 Jan 2022 08:11:35 -0500 Subject: [PATCH] Fix expanding external args (#847) --- crates/nu-command/src/system/run_external.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/system/run_external.rs b/crates/nu-command/src/system/run_external.rs index b1c61ab84f..acbc3d3f8e 100644 --- a/crates/nu-command/src/system/run_external.rs +++ b/crates/nu-command/src/system/run_external.rs @@ -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);