Browse Source

Fix Console fmt::Write impl

pull/10/head
panicbit 8 years ago
parent
commit
6eeab148d9
  1. 4
      src/console.rs

4
src/console.rs

@ -35,6 +35,10 @@ impl Default for Console {
impl Write for Console { impl Write for Console {
fn write_str(&mut self, s: &str) -> fmt::Result { fn write_str(&mut self, s: &str) -> fmt::Result {
// Writing 0 bytes to the console fails
if s.is_empty() {
return Ok(())
}
unsafe { consoleSelect(&mut self.context); } unsafe { consoleSelect(&mut self.context); }
let ret = unsafe { libc::write(libc::STDOUT_FILENO, s.as_ptr() as *const _, s.len()) }; let ret = unsafe { libc::write(libc::STDOUT_FILENO, s.as_ptr() as *const _, s.len()) };
if ret == s.len() as isize { if ret == s.len() as isize {

Loading…
Cancel
Save