From 809324ff0ca88a1c9443e503b7f99f6ac4039c6d Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy <mmstickman@gmail.com> Date: Fri, 27 Oct 2017 16:02:57 -0400 Subject: [PATCH] Only check for signals that we are listening to --- src/shell/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index f0f13e23..756aaddf 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -46,6 +46,7 @@ use std::sync::{Arc, Mutex}; use std::sync::atomic::Ordering; use std::time::SystemTime; use types::*; +use sys; /// The shell structure is a megastructure that manages all of the state of the shell throughout /// the entirety of the @@ -137,7 +138,7 @@ impl<'a> Shell { } pub(crate) fn next_signal(&self) -> Option<i32> { - for sig in 0..32 { + for &sig in &[sys::SIGINT, sys::SIGHUP, sys::SIGTERM] { if signals::PENDING.fetch_and(!(1 << sig), Ordering::SeqCst) & (1 << sig) == 1 << sig { return Some(sig); } -- GitLab