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:
parent
02de2ce640
commit
23eb92dae3
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue