From b7a3d674581720bfb63bf73cae8368ebbad81004 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sat, 25 Apr 2020 10:23:56 +0530 Subject: Avoid busy looping by not catching all exceptions This specifically avoids situation described in this issue https://github.com/jaor/xmobar/issues/438 where the handle was throwing the IOException continously in a loop: : hGetLine: invalid argument (invalid byte sequence) It happened because my system's environment was right, but the proper behaviour hear would be to let it to throw the exception rather than leading to a busy loop. I did some git blame to find out that this commit introduced the behaviour: https://github.com/jaor/xmobar/commit/fc24dc1874dcf7c9e66e21502a58b40cbe627c85 but there was no reason mentioned in the commit for trying to capture all exceptions. --- src/Xmobar/Plugins/StdinReader.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Xmobar/Plugins/StdinReader.hs b/src/Xmobar/Plugins/StdinReader.hs index bc4bb5f..18958be 100644 --- a/src/Xmobar/Plugins/StdinReader.hs +++ b/src/Xmobar/Plugins/StdinReader.hs @@ -31,7 +31,7 @@ data StdinReader = StdinReader | UnsafeStdinReader instance Exec StdinReader where start stdinReader cb = do - s <- handle (\(SomeException e) -> do hPrint stderr e; return "") getLine + s <- getLine cb $ escape stdinReader s eof <- isEOF if eof -- cgit v1.2.3