summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/StdinReader.hs
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2020-05-02 18:37:58 +0530
committerjao <jao@gnu.org>2020-05-02 16:34:52 +0100
commit68ac4d3ae6f37a2f73109f65f67e0b0d209696f0 (patch)
tree490ebb9a927ec26c2ca8eb6bb707ad2217f8f271 /src/Xmobar/Plugins/StdinReader.hs
parentb7a3d674581720bfb63bf73cae8368ebbad81004 (diff)
downloadxmobar-68ac4d3ae6f37a2f73109f65f67e0b0d209696f0.tar.gz
xmobar-68ac4d3ae6f37a2f73109f65f67e0b0d209696f0.tar.bz2
Update stderr and the bar on receiving exception
Diffstat (limited to 'src/Xmobar/Plugins/StdinReader.hs')
-rw-r--r--src/Xmobar/Plugins/StdinReader.hs9
1 files changed, 7 insertions, 2 deletions
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