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 <konradybcio@kernel.org>
This commit is contained in:
Konrad Dybcio
2024-05-07 02:22:12 +02:00
committed by Konrad Dybcio
parent 5bf2dcc137
commit 3e6ce0127e

View File

@@ -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::<Vec<_>>().join("\r\n").blue()
);
stdout().flush()?;
}