Skip to content

Commit

Permalink
std::sys::unix::stdio: explain why we do into_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 8, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent d30b99f commit 541503a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libstd/sys/unix/stdio.rs
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 541503a

Please sign in to comment.