diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-07 15:24:30 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-10 01:37:11 -0800 |
| commit | b652bbc6700e36c9ad80105c89d7fc2e3afec111 (patch) | |
| tree | d204a6217cfb8dbc41fdc44346a779ee60665924 /src/libstd/rt | |
| parent | df4c0b8e4349d50f317553de5a47d0cd56cdc227 (diff) | |
| download | rust-b652bbc6700e36c9ad80105c89d7fc2e3afec111.tar.gz rust-b652bbc6700e36c9ad80105c89d7fc2e3afec111.zip | |
Fall back from uv tty instances more aggressively
It appears that uv's support for interacting with a stdio stream as a tty when it's actually a pipe is pretty problematic. To get around this, promote a check to see if the stream is a tty to the top of the tty constructor, and bail out quickly if it's not identified as a tty. Closes #10237
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/io/stdio.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rt/rtio.rs | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/rt/io/stdio.rs index d33821a34b1..674b34639bc 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/rt/io/stdio.rs @@ -277,12 +277,10 @@ impl StdWriter { } } - /// Returns whether this tream is attached to a TTY instance or not. - /// - /// This is similar to libc's isatty() function + /// Returns whether this stream is attached to a TTY instance or not. pub fn isatty(&self) -> bool { match self.inner { - TTY(ref tty) => tty.isatty(), + TTY(*) => true, File(*) => false, } } diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 1e12da8645c..d623914cdad 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -222,7 +222,6 @@ pub trait RtioTTY { 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 { |
