std::sys::unix::stdio: explain why we do into_raw

This commit is contained in:
Ralf Jung 2019-02-08 11:41:01 +01:00
parent d30b99f9c2
commit 541503afa1

View File

@ -12,7 +12,7 @@ impl Stdin {
pub fn read(&self, data: &mut [u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDIN_FILENO);
let ret = fd.read(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}
}
@ -23,7 +23,7 @@ impl Stdout {
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDOUT_FILENO);
let ret = fd.write(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}
@ -38,7 +38,7 @@ impl Stderr {
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDERR_FILENO);
let ret = fd.write(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}