diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index c3948ce08cff248e7006d2957f0e0dbccdbb9c9c..32e74ae5915e4205e1090a2bf043f5e12d25dcb3 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -440,25 +440,11 @@ fn builtin_not(args: &[&str], shell: &mut Shell) -> i32 { } } -fn custom_eval(args: &[&str], shell: &mut Shell, un_terminated: &str) -> i32 { - let evaluated_command = args[1..].join(" "); - let mut buffer = Terminator::new(evaluated_command); - - if buffer.is_terminated() { - shell.on_command(&buffer.consume()); - shell.previous_status - } else { - let stderr = io::stderr(); - let mut stderr = stderr.lock(); - let _ = writeln!(stderr, "{}", un_terminated); - FAILURE - } -} - fn builtin_and(args: &[&str], shell: &mut Shell) -> i32 { match shell.previous_status { SUCCESS => { - custom_eval(args, shell, "ion: supplied expression after 'and' was not terminated") + shell.run_pipeline(&mut args_to_pipeline(&args[1..])); + shell.previous_status } _ => shell.previous_status, } @@ -467,7 +453,8 @@ fn builtin_and(args: &[&str], shell: &mut Shell) -> i32 { fn builtin_or(args: &[&str], shell: &mut Shell) -> i32 { match shell.previous_status { FAILURE => { - custom_eval(args, shell, "ion: supplied expression after 'and' was not terminated") + shell.run_pipeline(&mut args_to_pipeline(&args[1..])); + shell.previous_status } _ => shell.previous_status, }