From 0a75184c324364275a8dd1a053f943fc45bcadb2 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Fri, 24 May 2024 08:53:03 +0200 Subject: [PATCH] Fix output from example receive_data There was no visible output without explicitly flushing stdout on on macOS. --- examples/receive_data.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/receive_data.rs b/examples/receive_data.rs index 0821962e..0f10c28f 100644 --- a/examples/receive_data.rs +++ b/examples/receive_data.rs @@ -35,7 +35,10 @@ fn main() { println!("Receiving data on {} at {} baud:", &port_name, &baud_rate); loop { match port.read(serial_buf.as_mut_slice()) { - Ok(t) => io::stdout().write_all(&serial_buf[..t]).unwrap(), + Ok(t) => { + io::stdout().write_all(&serial_buf[..t]).unwrap(); + io::stdout().flush().unwrap(); + } Err(ref e) if e.kind() == io::ErrorKind::TimedOut => (), Err(e) => eprintln!("{:?}", e), }