]> git.lizzy.rs Git - rust.git/commitdiff
std::sys::unix::stdio: explain why we do into_raw
authorRalf Jung <post@ralfj.de>
Fri, 8 Feb 2019 10:41:01 +0000 (11:41 +0100)
committerRalf Jung <post@ralfj.de>
Fri, 8 Feb 2019 10:41:31 +0000 (11:41 +0100)
src/libstd/sys/unix/stdio.rs

index 8a6b7b5f876fff9058d0034bc79ba52a855a53cd..715f2eafb2d9b1df65d90c55eb2d2cc3d78541a1 100644 (file)
@@ -12,7 +12,7 @@ pub fn new() -> io::Result<Stdin> { Ok(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 @@ pub fn new() -> io::Result<Stdout> { Ok(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 @@ pub fn new() -> io::Result<Stderr> { Ok(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
     }