about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorJeremy Soller <jackpot51@gmail.com>2016-11-28 18:25:47 -0700
committerJeremy Soller <jackpot51@gmail.com>2016-11-28 18:25:47 -0700
commit1d0bba8224686d054378bcc4e853798d56fdfecf (patch)
treee50c33389112f9b43f8b4b2f443f6120518a663a /src/libstd/sys
parent2ec21327f25e4646ce64a2e331bb4702cf96dc99 (diff)
downloadrust-1d0bba8224686d054378bcc4e853798d56fdfecf.tar.gz
rust-1d0bba8224686d054378bcc4e853798d56fdfecf.zip
Move stdout/err flush into sys
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/redox/stdio.rs2
-rw-r--r--src/libstd/sys/unix/stdio.rs13
-rw-r--r--src/libstd/sys/windows/stdio.rs13
3 files changed, 25 insertions, 3 deletions
diff --git a/src/libstd/sys/redox/stdio.rs b/src/libstd/sys/redox/stdio.rs
index 1fe7e33a35e..aa8329bc283 100644
--- a/src/libstd/sys/redox/stdio.rs
+++ b/src/libstd/sys/redox/stdio.rs
@@ -73,7 +73,7 @@ impl io::Write for Stderr {
     }
 
     fn flush(&mut self) -> io::Result<()> {
-        cvt(syscall::fsync(2)).and(Ok(()))
+        Stderr::flush(self)
     }
 }
 
diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs
index 273341b1918..1002c60d303 100644
--- a/src/libstd/sys/unix/stdio.rs
+++ b/src/libstd/sys/unix/stdio.rs
@@ -43,6 +43,10 @@ impl Stdout {
         fd.into_raw();
         ret
     }
+
+    pub fn flush(&self) -> io::Result<()> {
+        Ok(())
+    }
 }
 
 impl Stderr {
@@ -54,6 +58,10 @@ impl Stderr {
         fd.into_raw();
         ret
     }
+
+    pub fn flush(&self) -> io::Result<()> {
+        Ok(())
+    }
 }
 
 // FIXME: right now this raw stderr handle is used in a few places because
@@ -63,7 +71,10 @@ impl io::Write for Stderr {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         Stderr::write(self, data)
     }
-    fn flush(&mut self) -> io::Result<()> { Ok(()) }
+    
+    fn flush(&mut self) -> io::Result<()> {
+        Stderr::flush(self)
+    }
 }
 
 pub const EBADF_ERR: i32 = ::libc::EBADF as i32;
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs
index 72788776ded..0d58da29323 100644
--- a/src/libstd/sys/windows/stdio.rs
+++ b/src/libstd/sys/windows/stdio.rs
@@ -156,6 +156,10 @@ impl Stdout {
     pub fn write(&self, data: &[u8]) -> io::Result<usize> {
         write(&self.0, data)
     }
+
+    pub fn flush(&self) -> io::Result<()> {
+        Ok(())
+    }
 }
 
 impl Stderr {
@@ -166,6 +170,10 @@ impl Stderr {
     pub fn write(&self, data: &[u8]) -> io::Result<usize> {
         write(&self.0, data)
     }
+
+    pub fn flush(&self) -> io::Result<()> {
+        Ok(())
+    }
 }
 
 // FIXME: right now this raw stderr handle is used in a few places because
@@ -175,7 +183,10 @@ impl io::Write for Stderr {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         Stderr::write(self, data)
     }
-    fn flush(&mut self) -> io::Result<()> { Ok(()) }
+    
+    fn flush(&mut self) -> io::Result<()> {
+        Stderr::flush(self)
+    }
 }
 
 impl NoClose {