Skip to content
Myr

Just trying some things out, initial functionality

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

authored by Max Triano · committed by David Peter · parent 1795e0e · Browse files · 1 file+19 added−5 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+19 added−5 removed

  • other:+19 added−5 removed

1 file+19 added−5 removed

modified:src/exec/command.rs+19 added-5 removed
7 unmodified lines
89/// Executes a command.10pub fn execute_command(mut cmd: Command, out_perm: &Mutex<()>) -> ExitCode {11 // Spawn the supplied command.12 let output = cmd.output();12 /* let output = cmd.output(); */13 // This sort of works:14 let child = cmd.spawn().expect("failed to wait on child");15 let output = child16 .wait_with_output()17 .expect("failed to wait on child"); 18 ExitCode::Success19 /* let child_handle = cmd.spawn();20 match child_handle {21 Ok(output) => {22 let exit_code = output.wait();23 }24 Err() => {2526 }27 } */28 // Then wait for the command to exit, if it was spawned.15 match output {29 /* match output {30 Ok(output) => {31 // While this lock is active, this thread will be the only thread allowed32 // to write its outputs.33 let _lock = out_perm.lock().unwrap();3435 let stdout = io::stdout();36 let stderr = io::stderr();3724 let _ = stdout.lock().write_all(&output.stdout);25 let _ = stderr.lock().write_all(&output.stderr);38 //let _ = stdout.lock().write_all(&output.stdout);39 //let _ = stderr.lock().write_all(&output.stderr);4041 if output.status.code() == Some(0) {42 ExitCode::Success43 } else {
7 unmodified lines
51 Err(why) => {52 print_error(format!("Problem while executing command: {}", why));53 ExitCode::GeneralError54 }41 }55 } */56}