From 68ac4d3ae6f37a2f73109f65f67e0b0d209696f0 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sat, 2 May 2020 18:37:58 +0530 Subject: Update stderr and the bar on receiving exception --- src/Xmobar/Plugins/StdinReader.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Xmobar/Plugins/StdinReader.hs') diff --git a/src/Xmobar/Plugins/StdinReader.hs b/src/Xmobar/Plugins/StdinReader.hs index 18958be..ad7291e 100644 --- a/src/Xmobar/Plugins/StdinReader.hs +++ b/src/Xmobar/Plugins/StdinReader.hs @@ -22,16 +22,21 @@ import Prelude import System.Posix.Process import System.Exit import System.IO -import Control.Exception (SomeException(..), handle) import Xmobar.Run.Exec import Xmobar.X11.Actions (stripActions) +import Xmobar.System.Utils (onSomeException) data StdinReader = StdinReader | UnsafeStdinReader deriving (Read, Show) instance Exec StdinReader where start stdinReader cb = do - s <- getLine + s <- + getLine `onSomeException` + (\e -> do + let errorMessage = "xmobar: Received exception " <> show e + hPrint stderr errorMessage + cb errorMessage) cb $ escape stdinReader s eof <- isEOF if eof -- cgit v1.2.3