about summary refs log tree commit diff
path: root/src/libstd/io/native
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/io/native')
-rw-r--r--src/libstd/io/native/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/io/native/mod.rs b/src/libstd/io/native/mod.rs
index cec0de00ec2..c92f480728e 100644
--- a/src/libstd/io/native/mod.rs
+++ b/src/libstd/io/native/mod.rs
@@ -206,7 +206,9 @@ impl rtio::IoFactory for IoFactory {
     }
     fn tty_open(&mut self, fd: c_int, _readable: bool) -> IoResult<~RtioTTY> {
         if unsafe { libc::isatty(fd) } != 0 {
-            Ok(~file::FileDesc::new(fd, true) as ~RtioTTY)
+            // Don't ever close the stdio file descriptors, nothing good really
+            // comes of that.
+            Ok(~file::FileDesc::new(fd, fd > libc::STDERR_FILENO) as ~RtioTTY)
         } else {
             Err(IoError {
                 kind: io::MismatchedFileTypeForOperation,