Fixed SIGTERM handling.

This commit is contained in:
shy 2021-04-21 21:14:10 +02:00
parent 21f546dc52
commit 186273c907

View file

@ -77,9 +77,9 @@ pub fn run(
}); });
// Main loop entry. // Main loop entry.
loop { 'main: loop {
// Process received signals. // Process received signals.
'outer: for signal in signals.pending() { for signal in signals.pending() {
match signal { match signal {
// Suspend execution on SIGTSTP. // Suspend execution on SIGTSTP.
SIGTSTP => suspend(&mut stdout)?, SIGTSTP => suspend(&mut stdout)?,
@ -90,7 +90,7 @@ pub fn run(
} }
SIGWINCH => layout.schedule_recalc(), SIGWINCH => layout.schedule_recalc(),
// Exit main loop on SIGTERM and SIGINT. // Exit main loop on SIGTERM and SIGINT.
SIGTERM | SIGINT => break 'outer, SIGTERM | SIGINT => break 'main,
// Reset clock on SIGUSR1. // Reset clock on SIGUSR1.
SIGUSR1 => { SIGUSR1 => {
clock.reset(); clock.reset();
@ -220,9 +220,8 @@ pub fn run(
// Timeout. Expected. // Timeout. Expected.
Err(mpsc::RecvTimeoutError::Timeout) => (), Err(mpsc::RecvTimeoutError::Timeout) => (),
// Disconnect. // Disconnect.
// TODO: When? Why? What to do?
Err(mpsc::RecvTimeoutError::Disconnected) => { Err(mpsc::RecvTimeoutError::Disconnected) => {
eprintln!("Unexpected disconnect from input thread."); eprintln!("Unexpected end of input thread.");
break; break;
} }
Ok(key) => { Ok(key) => {