MCPcopy Index your code
hub / github.com/RustPython/RustPython / dup_into_stdio

Function dup_into_stdio

crates/stdlib/src/posixsubprocess.rs:314–325  ·  view source on GitHub ↗
(fd: MaybeFd, io_fd: i32, dup2_stdio: F)

Source from the content-addressed store, hash-verified

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)?;

Callers 1

exec_innerFunction · 0.85

Calls 3

set_inheritableFunction · 0.50
as_raw_fdMethod · 0.45
as_fdMethod · 0.45

Tested by

no test coverage detected