10 pub fn new() -> io::Result<Stdin> { Ok(Stdin(())) }
13 impl io::Read for Stdin {
14 fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
15 let fd = FileDesc::new(libc::STDIN_FILENO);
16 let ret = fd.read(buf);
17 fd.into_raw(); // do not close this FD
23 pub fn new() -> io::Result<Stdout> { Ok(Stdout(())) }
26 impl io::Write for Stdout {
27 fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
28 let fd = FileDesc::new(libc::STDOUT_FILENO);
29 let ret = fd.write(buf);
30 fd.into_raw(); // do not close this FD
34 fn flush(&mut self) -> io::Result<()> {
40 pub fn new() -> io::Result<Stderr> { Ok(Stderr(())) }
43 impl io::Write for Stderr {
44 fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
45 let fd = FileDesc::new(libc::STDERR_FILENO);
46 let ret = fd.write(buf);
47 fd.into_raw(); // do not close this FD
51 fn flush(&mut self) -> io::Result<()> {
56 pub fn is_ebadf(err: &io::Error) -> bool {
57 err.raw_os_error() == Some(libc::EBADF as i32)
60 pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
62 pub fn panic_output() -> Option<impl io::Write> {