Print errors to stderr.
This commit is contained in:
parent
bef717e663
commit
68dab474ef
1 changed files with 4 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
@ -1,5 +1,4 @@
|
||||||
use std::{env, process};
|
use std::{env, process};
|
||||||
use std::io::Write;
|
|
||||||
use kitchentimer::{Config, AlarmRoster, run};
|
use kitchentimer::{Config, AlarmRoster, run};
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,18 +17,17 @@ fn main() {
|
||||||
|
|
||||||
// Run main loop.
|
// Run main loop.
|
||||||
if let Err(e) = run(config, alarm_roster, &mut spawned) {
|
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);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for remaining spawned processes to exit.
|
// Wait for remaining spawned processes to exit.
|
||||||
if let Some(ref mut child) = spawned {
|
if let Some(ref mut child) = spawned {
|
||||||
print!("Waiting for spawned process (PID {}) to exit ...", child.id());
|
eprint!("Waiting for spawned process (PID {}) to exit ...", child.id());
|
||||||
std::io::stdout().flush().unwrap();
|
|
||||||
|
|
||||||
match child.wait() {
|
match child.wait() {
|
||||||
Ok(status) => println!(" ok ({})", status),
|
Ok(status) => eprintln!(" ok ({})", status),
|
||||||
Err(error) => println!(" failed ({})", error),
|
Err(error) => eprintln!(" failed ({})", error),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue