devela::_dep::rustix::stdio

Function take_stdin

pub unsafe fn take_stdin() -> OwnedFd
Available on crate feature dep_rustix only.
Expand description

STDIN_FILENO—Standard input, owned.

This is similar to stdin, however it returns an OwnedFd which closes standard input when it is dropped.

§Safety

Safe std-using Rust code is permitted to assume that the stdin file descriptor is always valid. This function returns an OwnedFd which will close the stdin file descriptor when dropped.

§Warning

This has the same hazards as stdin.

§References