diff --git a/Cargo.toml b/Cargo.toml index cb0bd66b..6cf7fe16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,4 @@ edition = "2021" nix = "0.25.0" termion = "1.5.6" unicode-width = "0.1.9" -signal-hook = "0.3.17" #ctrlc = "3.2.2" +signal-hook = "0.3.17" diff --git a/src/elements/command.rs b/src/elements/command.rs index b74e1282..2ad74fb4 100644 --- a/src/elements/command.rs +++ b/src/elements/command.rs @@ -34,7 +34,7 @@ pub trait Command { Ok(ForkResult::Child) => { core.initialize_as_subshell(Pid::from_raw(0), pipe.pgid); io::connect(pipe, self.get_redirects()); - self.run_command(core, true); + self.run(core, true); core.exit() }, Ok(ForkResult::Parent { child } ) => { @@ -48,14 +48,14 @@ pub trait Command { fn nofork_exec(&mut self, core: &mut ShellCore) { if self.get_redirects().iter_mut().all(|r| r.connect(true)){ - self.run_command(core, false); + self.run(core, false); }else{ core.vars.insert("?".to_string(), "1".to_string()); } self.get_redirects().iter_mut().rev().for_each(|r| r.restore()); } - fn run_command(&mut self, _: &mut ShellCore, fork: bool); + fn run(&mut self, _: &mut ShellCore, fork: bool); fn get_text(&self) -> String; fn get_redirects(&mut self) -> &mut Vec; fn set_force_fork(&mut self); diff --git a/src/elements/command/brace.rs b/src/elements/command/brace.rs index 7fa04991..175774df 100644 --- a/src/elements/command/brace.rs +++ b/src/elements/command/brace.rs @@ -24,7 +24,7 @@ impl Command for BraceCommand { } } - fn run_command(&mut self, core: &mut ShellCore, _: bool) { + fn run(&mut self, core: &mut ShellCore, _: bool) { match self.script { Some(ref mut s) => s.exec(core), _ => panic!("SUSH INTERNAL ERROR (ParenCommand::exec)"), diff --git a/src/elements/command/if.rs b/src/elements/command/if.rs index 7132fd6d..13207d7c 100644 --- a/src/elements/command/if.rs +++ b/src/elements/command/if.rs @@ -18,7 +18,7 @@ pub struct IfCommand { impl Command for IfCommand { fn exec(&mut self, _: &mut ShellCore, _: &mut Pipe) -> Option {None} - fn run_command(&mut self, _: &mut ShellCore, _: bool) {} + fn run(&mut self, _: &mut ShellCore, _: bool) {} fn get_text(&self) -> String { self.text.clone() } fn get_redirects(&mut self) -> &mut Vec { &mut self.redirects } fn set_force_fork(&mut self) { self.force_fork = true; } diff --git a/src/elements/command/paren.rs b/src/elements/command/paren.rs index aa9080a7..03a33491 100644 --- a/src/elements/command/paren.rs +++ b/src/elements/command/paren.rs @@ -18,7 +18,7 @@ impl Command for ParenCommand { self.fork_exec(core, pipe) } - fn run_command(&mut self, core: &mut ShellCore, fork: bool) { + fn run(&mut self, core: &mut ShellCore, fork: bool) { if ! fork { panic!("SUSH INTERNAL ERROR (no fork for subshell)"); } diff --git a/src/elements/command/simple.rs b/src/elements/command/simple.rs index 2ddc2d4b..c614c692 100644 --- a/src/elements/command/simple.rs +++ b/src/elements/command/simple.rs @@ -42,7 +42,7 @@ impl Command for SimpleCommand { } } - fn run_command(&mut self, core: &mut ShellCore, fork: bool) { + fn run(&mut self, core: &mut ShellCore, fork: bool) { if ! fork { core.run_builtin(&mut self.args); return; diff --git a/src/elements/command/while.rs b/src/elements/command/while.rs index dbb672e0..5488be9b 100644 --- a/src/elements/command/while.rs +++ b/src/elements/command/while.rs @@ -25,7 +25,7 @@ impl Command for WhileCommand { } } - fn run_command(&mut self, core: &mut ShellCore, _: bool) { + fn run(&mut self, core: &mut ShellCore, _: bool) { loop { self.while_script.as_mut() .expect("SUSH INTERNAL ERROR (no script)")