Move stdout/err flush into sys
This commit is contained in:
parent
2ec21327f2
commit
1d0bba8224
4 changed files with 25 additions and 9 deletions
|
@ -81,16 +81,10 @@ impl Read for StdinRaw {
|
|||
}
|
||||
impl Write for StdoutRaw {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.0.write(buf) }
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
#[cfg(target_os = "redox")]
|
||||
fn flush(&mut self) -> io::Result<()> { self.0.flush() }
|
||||
}
|
||||
impl Write for StderrRaw {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.0.write(buf) }
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
#[cfg(target_os = "redox")]
|
||||
fn flush(&mut self) -> io::Result<()> { self.0.flush() }
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ impl io::Write for Stderr {
|
|||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
cvt(syscall::fsync(2)).and(Ok(()))
|
||||
Stderr::flush(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue