diff --git a/src/parser/shell_expand/mod.rs b/src/parser/shell_expand/mod.rs index 4a84b2cb78a7a37f03ca4e706d800929e1f061a1..8eab906da15b5a6350e84f5d255e1322a9312e96 100644 --- a/src/parser/shell_expand/mod.rs +++ b/src/parser/shell_expand/mod.rs @@ -43,7 +43,9 @@ fn expand_process<E: Expander>( quoted: bool, ) { if let Some(mut output) = expander.command(command) { - if quoted { + if output.is_empty() { + return + } else if quoted { let output: &str = if let Some(pos) = output.rfind(|x| x != '\n') { &output[..pos + 1] } else { diff --git a/src/shell/job.rs b/src/shell/job.rs index 3047e73d1417053985dd8b09b058ea056f1ef419..514911c642d028cd63b6dd5db35825c499714274 100644 --- a/src/shell/job.rs +++ b/src/shell/job.rs @@ -39,7 +39,7 @@ impl Job { let mut expanded = Array::new(); expanded.grow(self.args.len()); expanded.extend( - self.args.drain().flat_map(|arg| expand_arg(&arg, shell)).filter(|x| !x.is_empty()), + self.args.drain().flat_map(|arg| expand_arg(&arg, shell)), ); self.args = expanded; }