Skip to content
Myr

Use full names in command.rs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Thayne McCombs · committed by David Peter · parent 9f39f1d · Browse files · 1 file+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−11 removed

  • other:+11 added−11 removed

1 file+11 added−11 removed

modified:src/exec/command.rs+11 added-11 removed
8 unmodified lines
9struct Outputs {10 stdout: Vec<u8>,11 stderr: Vec<u8>,12}13struct OutputBuf<'a> {14 out_perm: &'a Mutex<()>,13struct OutputBuffer<'a> {14 output_permission: &'a Mutex<()>,15 outputs: Vec<Outputs>,16}1718impl<'a> OutputBuf<'a> {19 fn new(out_perm: &'a Mutex<()>) -> Self {18impl<'a> OutputBuffer<'a> {19 fn new(output_permission: &'a Mutex<()>) -> Self {20 Self {21 out_perm,21 output_permission,22 outputs: Vec::new(),23 }24 }25
7 unmodified lines
33 return;34 }35 // While this lock is active, this thread will be the only thread allowed36 // to write its outputs.37 let _lock = self.out_perm.lock().unwrap();37 let _lock = self.output_permission.lock().unwrap();3839 let stdout = io::stdout();40 let stderr = io::stderr();41
12 unmodified lines
54 cmds: I,55 out_perm: &Mutex<()>,56 enable_output_buffering: bool,57) -> ExitCode {58 let mut out_buf = OutputBuf::new(out_perm);58 let mut output_buffer = OutputBuffer::new(out_perm);59 for mut cmd in cmds {60 // Spawn the supplied command.61 let output = if enable_output_buffering {62 cmd.output()
6 unmodified lines
69 // Then wait for the command to exit, if it was spawned.70 match output {71 Ok(output) => {72 if enable_output_buffering {73 out_buf.push(output.stdout, output.stderr);73 output_buffer.push(output.stdout, output.stderr);74 }75 if output.status.code() != Some(0) {76 out_buf.write();76 output_buffer.write();77 return ExitCode::GeneralError;78 }79 }80 Err(why) => {81 out_buf.write();81 output_buffer.write();82 return handle_cmd_error(&cmd, why);83 }84 }85 }86 out_buf.write();86 output_buffer.write();87 ExitCode::Success88}8990pub fn handle_cmd_error(cmd: &Command, err: io::Error) -> ExitCode {
8 unmodified lines