Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 13, 2024
2 parents 07ea7ca + cc6afed commit c4a47b7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions src/elements/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 } ) => {
Expand All @@ -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<Redirect>;
fn set_force_fork(&mut self);
Expand Down
2 changes: 1 addition & 1 deletion src/elements/command/brace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)"),
Expand Down
2 changes: 1 addition & 1 deletion src/elements/command/if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Command for IfCommand {
}


fn run_command(&mut self, core: &mut ShellCore, _: bool) {
fn run(&mut self, core: &mut ShellCore, _: bool) {
for i in 0..self.if_elif_scripts.len() {
self.if_elif_scripts[i].exec(core);
if core.vars["?"] == "0" {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/command/paren.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
}
Expand Down
2 changes: 1 addition & 1 deletion src/elements/command/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/elements/command/while.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down

0 comments on commit c4a47b7

Please sign in to comment.