From 3e6ce0127e2439dffacbab0107e030aa2d86a7aa Mon Sep 17 00:00:00 2001 From: Konrad Dybcio Date: Tue, 7 May 2024 02:22:12 +0200 Subject: [PATCH] main: Replace LF with CRLF for server status updates These can apparently be handled too slow (because the stdin handler thread takes its sweet time to spin up?), and receiving e.g. the hello message ("Starting cdba server") and some warning (like "cdba-server: Please switch to yaml config for ftdi_gpio configuration") separated with a single LF char on the server side ends up with a janky printout. This is not ideal, but I suppose acking of the server status updates could be introduced in a future update.. Signed-off-by: Konrad Dybcio --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fcf7f0e..f2f3a7b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,7 +135,10 @@ async fn main() -> anyhow::Result<()> { // Stream of "blue text" - status updates from the server if let Ok(bytes_read) = (*get_arc!(chan)).stderr().read(&mut buf) { let s = String::from_utf8_lossy(&buf[..bytes_read]); - writeln!(stdout(), "{}\r", s.blue())?; + print!( + "{}\r", + s.split('\n').collect::>().join("\r\n").blue() + ); stdout().flush()?; }