fn initial_ir(cmd: &BasicCmd) {
    let fd = unsafe {
        libc::open(
            cmd.in_red_path_cstring().unwrap().as_ptr(),
            libc::O_RDONLY,
        )
    };
    if fd == -1 {
        panic!("Input redirect path {} can't be opened/read! {}", cmd.in_red_path().as_ref().unwrap(), errno::errno());
    }
    let ret = unsafe { libc::dup2(fd, libc::STDIN_FILENO) };
    if ret == -1 {
        panic!("Error dup2() input redirect! {}", errno::errno());
    }
}
/// Handles initial input redirect (from file).
Handles initial input redirect (from file).
Handles initial input redirect ( from file ) .
fn initial_ir(cmd: &BasicCmd) {
    let fd = unsafe {
        libc::open(
            cmd.in_red_path_cstring().unwrap().as_ptr(),
            libc::O_RDONLY,
        )
    };
    if fd == -1 {
        panic!("Input redirect path {} can't be opened/read! {}", cmd.in_red_path().as_ref().unwrap(), errno::errno());
    }
    let ret = unsafe { libc::dup2(fd, libc::STDIN_FILENO) };
    if ret == -1 {
        panic!("Error dup2() input redirect! {}", errno::errno());
    }
}
fn initial_ir ( cmd : & BasicCmd ) { let fd = unsafe { libc :: open ( cmd . in_red_path_cstring ( ) . unwrap ( ) . as_ptr ( ) , libc :: O_RDONLY , ) } ; if fd == - 1 { panic ! ( " " cmd in_red_path ( ) as_ref ( ) unwrap ( ) errno errno ( ) ) ; } let ret = unsafe { libc :: dup2 ( fd , libc :: STDIN_FILENO ) } ; if ret == - 1 { panic ! ( " " errno errno ( ) ) ; } }
Handles initial input redirect (from file).
Handles initial input redirect ( from file ) .
cmd
&BasicCmd
cmd
&BasicCmd