Skip to content

Commit

Permalink
Merge branch 'sd/202406_3' into sd/202407_1
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 12, 2024
2 parents 774a230 + e0288dd commit 5f852f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/elements/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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 @@ -46,14 +46,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/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

0 comments on commit 5f852f7

Please sign in to comment.