diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index e6d416164d008831ad2af668ba3154916f7298d5..991f3992dd1bd4952d80fb49a1722ce2498b76b4 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -290,6 +290,16 @@ pub struct StdReader { inner: StdSource } +impl StdReader { + /// Returns whether this stream is attached to a TTY instance or not. + pub fn isatty(&self) -> bool { + match self.inner { + TTY(..) => true, + File(..) => false, + } + } +} + impl Reader for StdReader { fn read(&mut self, buf: &mut [u8]) -> IoResult { let ret = match self.inner {