Function rustix::io::take_stdin

source ·
pub unsafe fn take_stdin() -> OwnedFd
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