diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:26:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:26:02 -0500 |
commit | d67d7cda39f5c3a84ee030778d69cdf08634a33c (patch) | |
tree | 8f99f1e559201ee8bb70787b13d514c7ba15c13c /src/runner/command.rs | |
parent | cba518546d09e9a716c9230ace1bbadd1c14fc2d (diff) | |
download | nbsh-d67d7cda39f5c3a84ee030778d69cdf08634a33c.tar.gz nbsh-d67d7cda39f5c3a84ee030778d69cdf08634a33c.zip |
fix builtins wrapping builtins
Diffstat (limited to 'src/runner/command.rs')
-rw-r--r-- | src/runner/command.rs | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/runner/command.rs b/src/runner/command.rs index 34b770e..5d4c11e 100644 --- a/src/runner/command.rs +++ b/src/runner/command.rs @@ -9,11 +9,11 @@ pub struct Command { >, } impl Command { - pub fn new(exe: crate::parse::Exe) -> Self { + pub fn new(exe: crate::parse::Exe, io: super::builtins::Io) -> Self { let exe_path = exe.exe().to_path_buf(); let redirects = exe.redirects().to_vec(); Self { - inner: super::builtins::Command::new(exe).map_or_else( + inner: super::builtins::Command::new(exe, io).map_or_else( |exe| Self::new_binary(exe).inner, Inner::Builtin, ), @@ -23,24 +23,6 @@ impl Command { } } - pub fn new_with_io( - exe: crate::parse::Exe, - io: super::builtins::Io, - ) -> Self { - let exe_path = exe.exe().to_path_buf(); - let redirects = exe.redirects().to_vec(); - Self { - inner: super::builtins::Command::new_with_io(exe, io) - .map_or_else( - |exe| Self::new_binary(exe).inner, - Inner::Builtin, - ), - exe: exe_path, - redirects, - pre_exec: None, - } - } - #[allow(clippy::needless_pass_by_value)] pub fn new_binary(exe: crate::parse::Exe) -> Self { let exe_path = exe.exe().to_path_buf(); @@ -55,11 +37,14 @@ impl Command { } } - pub fn new_builtin(exe: crate::parse::Exe) -> Self { + pub fn new_builtin( + exe: crate::parse::Exe, + io: super::builtins::Io, + ) -> Self { let exe_path = exe.exe().to_path_buf(); let redirects = exe.redirects().to_vec(); Self { - inner: super::builtins::Command::new(exe) + inner: super::builtins::Command::new(exe, io) .map_or_else(|_| todo!(), Inner::Builtin), exe: exe_path, redirects, |