/// Spawns the [program] and passes [args] to it. Exits if the process doesn't
/// completes successfully.
Spawns the [program] and passes [args] to it. Exits if the process doesn't
completes successfully.
Spawns the [ program ] and passes [ args ] to it . Exits if the process doesn ' t completes successfully .
pub fn spawn_process<P, I, S>(program: P, args: I) -> Output
where
    P: AsRef<OsStr>,
    I: IntoIterator<Item = S>,
    S: AsRef<OsStr>,
{
    let output = Command::new(program).args(args).output().unwrap();
    if !output.status.success() {
        if !output.stderr.is_empty() {
            eprintln!(
                "       {} {}",
                Red.paint("error"),
                String::from_utf8(output.stderr)
                    .unwrap()
                    .replace("\n", "\n        ")
            );
        }
        if !output.stdout.is_empty() {
            eprintln!(
                "       {} {}",
                Red.paint("error"),
                String::from_utf8(output.stdout)
                    .unwrap()
                    .replace("\n", "\n        ")
            );
        }
        process::exit(1);
    }
    output
}
pub fn spawn_process < P , I , S > ( program : P , args : I ) -> Output where P : AsRef < OsStr > , I : IntoIterator < Item = S > , S : AsRef < OsStr > , { let output = Command :: new ( program ) . args ( args ) . output ( ) . unwrap ( ) ; if ! output . status . success ( ) { if ! output . stderr . is_empty ( ) { eprintln ! ( " " Red paint ( " " ) String from_utf8 ( output stderr ) unwrap ( ) replace ( " \n " " \n " ) ) ; } if ! output . stdout . is_empty ( ) { eprintln ! ( " " Red paint ( " " ) String from_utf8 ( output stdout ) unwrap ( ) replace ( " \n " " \n " ) ) ; } process :: exit ( 1 ) ; } output }
Spawns the [program] and passes [args] to it.
Spawns the [ program ] and passes [ args ] to it .
program
P
args
I