From 309f3078c6c272613b83d692f9908c8fb43d6d4c Mon Sep 17 00:00:00 2001 From: Jens Nolte <jens@nightmarestudio.de> Date: Mon, 9 Mar 2020 00:26:37 +0100 Subject: [PATCH] Remove broken SIGTERM handler --- src/QBar/Host.hs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/QBar/Host.hs b/src/QBar/Host.hs index 24c471a..c730da3 100644 --- a/src/QBar/Host.hs +++ b/src/QBar/Host.hs @@ -7,7 +7,7 @@ import QBar.BlockOutput import QBar.Core import QBar.Time -import Control.Concurrent (ThreadId, forkIO, forkFinally, threadDelay, myThreadId, throwTo) +import Control.Concurrent (forkIO, forkFinally, threadDelay) import Control.Concurrent.Async (async, wait) import qualified Control.Concurrent.Event as Event import Control.Concurrent.MVar (MVar, newMVar, modifyMVar_, swapMVar) @@ -19,11 +19,9 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Maybe (catMaybes, mapMaybe) import qualified Data.Text.Lazy as T import Pipes -import System.Exit import System.IO (stderr, hPutStrLn) -import System.Posix.Process (createSession) -import System.Posix.Signals (Handler(..), sigTERM, sigCONT, signalProcessGroup, installHandler) -import System.Posix.Types (ProcessGroupID) +import System.Posix.Signals (Handler(..), sigCONT, installHandler) + data HostHandle = HostHandle { barUpdateEvent :: BarUpdateEvent, @@ -34,23 +32,12 @@ data HostHandle = HostHandle { } installSignalHandlers :: Bar -> IO () -installSignalHandlers bar = do - mainThread <- myThreadId - processGroup <- createSession - void $ installHandler sigCONT (Catch sigContAction) Nothing - void $ installHandler sigTERM (Catch $ sigTermAction mainThread processGroup) Nothing +installSignalHandlers bar = void $ installHandler sigCONT (Catch sigContAction) Nothing where sigContAction :: IO () sigContAction = do hPutStrLn stderr "SIGCONT received" updateBarDefault' bar - sigTermAction :: ThreadId -> ProcessGroupID -> IO () - sigTermAction mainThread processGroup = do - void $ installHandler sigTERM Ignore Nothing - hPutStrLn stderr "SIGTERM received" - hPutStrLn stderr "Killing process group" - signalProcessGroup sigTERM processGroup - throwTo mainThread $ ExitFailure 143 eventDispatcher :: Bar -> IORef [(T.Text, BlockEventHandler)] -> Consumer BlockEvent IO () -- GitLab