There are issues with reading stdin when it is actually attached to a pipe, but
I have run into no problems in writing to stdout/stderr when they are attached
to pipes.
// Related:
// - https://github.com/joyent/libuv/issues/982
// - https://github.com/joyent/libuv/issues/988
- if unsafe { uvll::guess_handle(fd) != uvll::UV_TTY as libc::c_int } {
+ let guess = unsafe { uvll::guess_handle(fd) };
+ if readable && guess != uvll::UV_TTY as libc::c_int {
return Err(UvError(uvll::EBADF));
}
n => Err(uv_error_to_io_error(UvError(n)))
}
}
+
+ fn isatty(&self) -> bool {
+ unsafe { uvll::guess_handle(self.fd) == uvll::UV_TTY as libc::c_int }
+ }
}
impl UvHandle<uvll::uv_tty_t> for TtyWatcher {
fn get_winsize(&mut self) -> Result<(int, int), IoError> {
Err(super::unimpl())
}
+ fn isatty(&self) -> bool { false }
}
impl Drop for FileDesc {
fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
fn set_raw(&mut self, raw: bool) -> Result<(), IoError>;
fn get_winsize(&mut self) -> Result<(int, int), IoError>;
+ fn isatty(&self) -> bool;
}
pub trait PausibleIdleCallback {