From 68dab474ef9293f29e99205e47c8454749fa57b2 Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 13 Apr 2021 11:36:07 +0200 Subject: [PATCH] Print errors to stderr. --- src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3476a8c..9e6dc64 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ use std::{env, process}; -use std::io::Write; use kitchentimer::{Config, AlarmRoster, run}; @@ -18,18 +17,17 @@ fn main() { // Run main loop. if let Err(e) = run(config, alarm_roster, &mut spawned) { - println!("Main loop exited with error: {}", e); + eprintln!("Main loop exited with error: {}", e); process::exit(1); } // Wait for remaining spawned processes to exit. if let Some(ref mut child) = spawned { - print!("Waiting for spawned process (PID {}) to exit ...", child.id()); - std::io::stdout().flush().unwrap(); + eprint!("Waiting for spawned process (PID {}) to exit ...", child.id()); match child.wait() { - Ok(status) => println!(" ok ({})", status), - Err(error) => println!(" failed ({})", error), + Ok(status) => eprintln!(" ok ({})", status), + Err(error) => eprintln!(" failed ({})", error), } } }