pub fn run_simple_command<E, F: FnOnce(std::io::Error) -> E, F2: FnOnce(ExitStatus) -> E>(
    command: &mut Command,
    io_error_fn: F,
    exit_status_fn: F2,
) -> Result<ExitStatus, E> {
    command
        .spawn()
        .and_then(|mut child| child.wait())
        .map_err(io_error_fn)
        .and_then(|exit_status| {
            if exit_status.success() {
                Ok(exit_status)
            } else {
                Err(exit_status_fn(exit_status))
            }
        })
}
/// Helper to run very simple commands where we just need to handle IO errors and non-zero exit
/// codes. Not very useful in complex scenarios, but can cut down the amount of code in simple
/// cases.
Helper to run very simple commands where we just need to handle IO errors and non-zero exit
codes. Not very useful in complex scenarios, but can cut down the amount of code in simple
cases.
Helper to run very simple commands where we just need to handle IO errors and non - zero exit codes . Not very useful in complex scenarios but can cut down the amount of code in simple cases .
pub fn run_simple_command<E, F: FnOnce(std::io::Error) -> E, F2: FnOnce(ExitStatus) -> E>(
    command: &mut Command,
    io_error_fn: F,
    exit_status_fn: F2,
) -> Result<ExitStatus, E> {
    command
        .spawn()
        .and_then(|mut child| child.wait())
        .map_err(io_error_fn)
        .and_then(|exit_status| {
            if exit_status.success() {
                Ok(exit_status)
            } else {
                Err(exit_status_fn(exit_status))
            }
        })
}
pub fn run_simple_command < E , F : FnOnce ( std :: io :: Error ) -> E , F2 : FnOnce ( ExitStatus ) -> E > ( command : & mut Command , io_error_fn : F , exit_status_fn : F2 , ) -> Result < ExitStatus , E > { command . spawn ( ) . and_then ( | mut child | child . wait ( ) ) . map_err ( io_error_fn ) . and_then ( | exit_status | { if exit_status . success ( ) { Ok ( exit_status ) } else { Err ( exit_status_fn ( exit_status ) ) } } ) }
Helper to run very simple commands where we just need to handle IO errors and non-zero exit
codes.
Helper to run very simple commands where we just need to handle IO errors and non - zero exit codes .
command
&mut Command
io_error_fn
F
exit_status_fn
F2
command
&mut Command
io_error_fn
F
exit_status_fn
F2