diff options
author | Sibi Prabakaran <sibi@psibi.in> | 2020-04-25 10:23:56 +0530 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-05-02 16:34:52 +0100 |
commit | b7a3d674581720bfb63bf73cae8368ebbad81004 (patch) | |
tree | 09b27953448052bf8f6ce0245f1e4d8ecf19f856 /src/Xmobar/Plugins/StdinReader.hs | |
parent | a135fcf40172355bc36bc6d4f98b484375dc5add (diff) | |
download | xmobar-b7a3d674581720bfb63bf73cae8368ebbad81004.tar.gz xmobar-b7a3d674581720bfb63bf73cae8368ebbad81004.tar.bz2 |
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:
<stdin>: 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.
Diffstat (limited to 'src/Xmobar/Plugins/StdinReader.hs')
-rw-r--r-- | src/Xmobar/Plugins/StdinReader.hs | 2 |
1 files changed, 1 insertions, 1 deletions
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 |