Function rustix::io::take_stderr
source · pub unsafe fn take_stderr() -> OwnedFd
Expand description
STDERR_FILENO
—Standard error, owned.
This is similar to stdout
, however it returns an OwnedFd
which closes
standard output when it is dropped.
Safety
This is unsafe for the same reasons as stderr
.
Other hazards
This has the same hazards as stderr
.
And, when the OwnedFd
is dropped, subsequent newly created file
descriptors may unknowingly reuse the stderr file descriptor number, which
may break common assumptions, so it should typically only be dropped at the
end of a program when no more file descriptors will be created.