mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-22 15:40:41 +00:00
lock stdout
To help prevent race conditions, and ensuring safe output
This commit is contained in:
parent
9de9222033
commit
c301ce0feb
1 changed files with 3 additions and 2 deletions
|
@ -93,10 +93,11 @@ fn print_system_info(fields: &Fields) -> io::Result<()> {
|
|||
.max()
|
||||
.unwrap_or(0);
|
||||
|
||||
writeln!(io::stdout(), "{:<27} {} ~{RESET}", LOGO[0], user_info)?;
|
||||
let mut handle = io::stdout().lock();
|
||||
writeln!(handle, "{:<27} {} ~{RESET}", LOGO[0], user_info)?;
|
||||
for (logo_line, (icon, label, value)) in LOGO[1..].iter().zip(system_info.iter()) {
|
||||
writeln!(
|
||||
io::stdout(),
|
||||
handle,
|
||||
"{:<27} {CYAN}{:<2} {BLUE}{:<width$}{RESET} {value}{RESET}",
|
||||
logo_line,
|
||||
icon,
|
||||
|
|
Loading…
Reference in a new issue