Skip to content

Commit 541503a

Browse files
committed
std::sys::unix::stdio: explain why we do into_raw
1 parent d30b99f commit 541503a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libstd/sys/unix/stdio.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl Stdin {
1212
pub fn read(&self, data: &mut [u8]) -> io::Result<usize> {
1313
let fd = FileDesc::new(libc::STDIN_FILENO);
1414
let ret = fd.read(data);
15-
fd.into_raw();
15+
fd.into_raw(); // do not close this FD
1616
ret
1717
}
1818
}
@@ -23,7 +23,7 @@ impl Stdout {
2323
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
2424
let fd = FileDesc::new(libc::STDOUT_FILENO);
2525
let ret = fd.write(data);
26-
fd.into_raw();
26+
fd.into_raw(); // do not close this FD
2727
ret
2828
}
2929

@@ -38,7 +38,7 @@ impl Stderr {
3838
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
3939
let fd = FileDesc::new(libc::STDERR_FILENO);
4040
let ret = fd.write(data);
41-
fd.into_raw();
41+
fd.into_raw(); // do not close this FD
4242
ret
4343
}
4444

0 commit comments

Comments
 (0)