From 186273c9079395e445184e174576a579ef3b3a9b Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 21 Apr 2021 21:14:10 +0200 Subject: [PATCH] Fixed SIGTERM handling. --- src/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8d5dd09..2323cba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,9 +77,9 @@ pub fn run( }); // Main loop entry. - loop { + 'main: loop { // Process received signals. - 'outer: for signal in signals.pending() { + for signal in signals.pending() { match signal { // Suspend execution on SIGTSTP. SIGTSTP => suspend(&mut stdout)?, @@ -90,7 +90,7 @@ pub fn run( } SIGWINCH => layout.schedule_recalc(), // Exit main loop on SIGTERM and SIGINT. - SIGTERM | SIGINT => break 'outer, + SIGTERM | SIGINT => break 'main, // Reset clock on SIGUSR1. SIGUSR1 => { clock.reset(); @@ -220,9 +220,8 @@ pub fn run( // Timeout. Expected. Err(mpsc::RecvTimeoutError::Timeout) => (), // Disconnect. - // TODO: When? Why? What to do? Err(mpsc::RecvTimeoutError::Disconnected) => { - eprintln!("Unexpected disconnect from input thread."); + eprintln!("Unexpected end of input thread."); break; } Ok(key) => {