From a8c22d161eeb38f7234e1e3453d24ab5927c976f Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy <mmstickman@gmail.com> Date: Sun, 1 Oct 2017 11:19:35 -0400 Subject: [PATCH] Commands can be expanded now Fixes issues like the following: ~/.cargo/bin/ion -c echo test let COM = echo; $COM test --- src/shell/pipe_exec/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shell/pipe_exec/mod.rs b/src/shell/pipe_exec/mod.rs index fb50b306..2f9de2c8 100644 --- a/src/shell/pipe_exec/mod.rs +++ b/src/shell/pipe_exec/mod.rs @@ -275,12 +275,12 @@ impl<'a> PipelineExecution for Shell<'a> { } else if Path::new(&job.args[0]).is_dir() { eprintln!("ion: cannot execute directory as command"); return Err(FAILURE); - } else if self.functions.contains_key::<str>(job.command.as_ref()) { - RefinedJob::function(job.command, job.args.drain().collect()) - } else if self.builtins.contains_key::<str>(job.command.as_ref()) { - RefinedJob::builtin(job.command, job.args.drain().collect()) + } else if self.functions.contains_key::<str>(job.args[0].as_ref()) { + RefinedJob::function(job.args[0].clone().into(), job.args.drain().collect()) + } else if self.builtins.contains_key::<str>(job.args[0].as_ref()) { + RefinedJob::builtin(job.args[0].clone().into(), job.args.drain().collect()) } else { - let mut command = Command::new(job.command); + let mut command = Command::new(job.args[0].clone()); for arg in job.args.drain().skip(1) { command.arg(arg); } -- GitLab