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

Function set_inheritable

crates/vm/src/stdlib/posix.rs:7–16  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>, inheritable: bool)

Source from the content-addressed store, hash-verified

5pub(crate) use module::module_def;
6
7pub fn set_inheritable(fd: BorrowedFd<'_>, inheritable: bool) -> nix::Result<()> {
8 use nix::fcntl;
9 let flags = fcntl::FdFlag::from_bits_truncate(fcntl::fcntl(fd, fcntl::FcntlArg::F_GETFD)?);
10 let mut new_flags = flags;
11 new_flags.set(fcntl::FdFlag::FD_CLOEXEC, !inheritable);
12 if flags != new_flags {
13 fcntl::fcntl(fd, fcntl::FcntlArg::F_SETFD(new_flags))?;
14 }
15 Ok(())
16}
17
18#[pymodule(name = "posix", with(
19 super::os::_os,

Callers 6

pipeFunction · 0.70
openptyFunction · 0.70
dupFunction · 0.70
dup2Function · 0.70
exec_innerFunction · 0.50
dup_into_stdioFunction · 0.50

Calls 3

fcntlFunction · 0.85
setMethod · 0.45
into_pyexceptionMethod · 0.45

Tested by

no test coverage detected