From 7ce8026916df5745dfc1b4c32fed4e61a09e597a Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 7 May 2020 09:18:56 +1200 Subject: [PATCH] Ignore empty arguments passed to externals (#1722) --- crates/nu-cli/src/commands/classified/external.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/nu-cli/src/commands/classified/external.rs b/crates/nu-cli/src/commands/classified/external.rs index 6c1484aa1e..d21796d31f 100644 --- a/crates/nu-cli/src/commands/classified/external.rs +++ b/crates/nu-cli/src/commands/classified/external.rs @@ -116,6 +116,12 @@ fn run_with_stdin( let mut command_args = vec![]; for arg in command.args.iter() { let value = evaluate_baseline_expr(arg, &context.registry, scope)?; + // Skip any arguments that don't really exist, treating them as optional + // FIXME: we may want to preserve the gap in the future, though it's hard to say + // what value we would put in its place. + if value.value.is_none() { + continue; + } // Do the cleanup that we need to do on any argument going out: let trimmed_value_string = value.as_string()?.trim_end_matches('\n').to_string();