(fd: MaybeFd, io_fd: i32, dup2_stdio: F)
| 312 | } |
| 313 | |
| 314 | fn dup_into_stdio<F>(fd: MaybeFd, io_fd: i32, dup2_stdio: F) -> nix::Result<()> |
| 315 | where |
| 316 | F: Fn(Fd) -> nix::Result<()>, |
| 317 | { |
| 318 | match fd { |
| 319 | MaybeFd::Valid(fd) if fd.as_raw_fd() == io_fd => { |
| 320 | posix::set_inheritable(fd.as_fd(), true) |
| 321 | } |
| 322 | MaybeFd::Valid(fd) => dup2_stdio(fd), |
| 323 | MaybeFd::Invalid => Ok(()), |
| 324 | } |
| 325 | } |
| 326 | dup_into_stdio(args.p2cread, 0, unistd::dup2_stdin)?; |
| 327 | dup_into_stdio(c2pwrite, 1, unistd::dup2_stdout)?; |
| 328 | dup_into_stdio(errwrite, 2, unistd::dup2_stderr)?; |
no test coverage detected