use blocking stdout

awaiting on stdout allows new lines to be processed when we are
already done with and about to print a line, which causes lines
arriving quickly (like the MOTD text) to appear out of order.
This commit is contained in:
xfnw 2024-03-09 12:15:33 -05:00
parent 02de2ce640
commit 23eb92dae3
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
use clap::Parser;
use std::{path::PathBuf, sync::Arc};
use std::{io::Write, path::PathBuf, sync::Arc};
use tokio::{
io::{self, AsyncBufReadExt, AsyncWriteExt, BufReader},
net::TcpStream,
@ -185,7 +185,7 @@ async fn handle_irc(stream: impl io::AsyncReadExt + io::AsyncWriteExt) {
trim_mut(&mut ircbuf);
ircbuf.push(b'\n');
io::stdout().write_all(&ircbuf).await.expect("broken pipe");
std::io::stdout().write_all(&ircbuf).expect("broken pipe");
ircbuf.clear();
}