fn execute(cmdline: &CommandLine) {
    let mut _cmd = Command::new(&cmdline.cmd);
    let cmd = _cmd.args(&cmdline.args);

    if cmdline.bg {
        if let Err(why) = cmd.spawn() {
            printerr!(why);
        }
    } else {
        if let Err(why) = cmd.stdout(Stdio::inherit())
                             .stderr(Stdio::inherit())
                             .output() {
            if let Some(errno) = why.raw_os_error() {
                match errno {
                    2 => printerr!(format!("{}: {}", cmdline.cmd,
                                           "Command not found")),
                    _  => printerr!(format!("{}: {}", cmdline.cmd, why)),
                }
                return
            }

            // getting here is pretty rare, means error didn't have os errno
            printerr!(why);
        }
    }
}
/*
 * execute - execute shell command line based on input CommandLine
 */
execute shell command line based on input CommandLine
execute shell command line based on input CommandLine
fn execute(cmdline: &CommandLine) {
    let mut _cmd = Command::new(&cmdline.cmd);
    let cmd = _cmd.args(&cmdline.args);
    if cmdline.bg {
        if let Err(why) = cmd.spawn() {
            printerr!(why);
        }
    } else {
        if let Err(why) = cmd.stdout(Stdio::inherit())
                             .stderr(Stdio::inherit())
                             .output() {
            if let Some(errno) = why.raw_os_error() {
                match errno {
                    2 => printerr!(format!("{}: {}", cmdline.cmd,
                                           "Command not found")),
                    _  => printerr!(format!("{}: {}", cmdline.cmd, why)),
                }
                return
            }
            // getting here is pretty rare, means error didn't have os errno
            printerr!(why);
        }
    }
}
fn execute ( cmdline : & CommandLine ) { let mut _cmd = Command :: new ( & cmdline . cmd ) ; let cmd = _cmd . args ( & cmdline . args ) ; if cmdline . bg { if let Err ( why ) = cmd . spawn ( ) { printerr ! ( why ) ; } } else { if let Err ( why ) = cmd . stdout ( Stdio :: inherit ( ) ) . stderr ( Stdio :: inherit ( ) ) . output ( ) { if let Some ( errno ) = why . raw_os_error ( ) { match errno { 2 => printerr ! ( format ( " " cmdline cmd " " ) ) , _ => printerr ! ( format ( " " cmdline cmd why ) ) , } return } // getting here is pretty rare, means error didn't have os errno printerr ! ( why ) ; } } }
execute - execute shell command line based on input CommandLine
execute - execute shell command line based on input CommandLine
cmdline
&CommandLine
cmdline
&CommandLine