summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/StdinReader.hs
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2020-11-18 18:49:00 +0000
committerjao <jao@gnu.org>2020-11-19 13:38:15 +0000
commit0cb56eb14e4e7c9257b290a8e22331d90145105c (patch)
treed599587abf1c5840a7279e1bbe5d116419915dfb /src/Xmobar/Plugins/StdinReader.hs
parentb23fc95a3bc2c0fefba7a44d6f1a4e8e0941d77c (diff)
downloadxmobar-0cb56eb14e4e7c9257b290a8e22331d90145105c.tar.gz
xmobar-0cb56eb14e4e7c9257b290a8e22331d90145105c.tar.bz2
StdinReader: Remove throttling on exception
Introducing the throttling unfortunately has a negative side-effect: it delays all stdin processing, including EOF detection, which can cause confusion the previous commit tries to fix. The only benefit of the throttling is to prevent 100% CPU usage when a lot of garbage is provided on xmobar stdin. We still don't know where that garbage comes from in https://github.com/jaor/xmobar/issues/438, or rather why there's more than a handful of lines of such garbage. @psibi has since fixed his setup to not produce that garbage, and no one else ever reported such a problem, so it's probably safe to ignore it for now. Should anyone ever encounter that again, feel free to ping me, even in the middle of the night, to help debug this. Fixes: 7759df11f746 ("StdinReader: Improve exception handling") Fixes: b7a3d6745817 ("Avoid busy looping by not catching all exceptions")
Diffstat (limited to 'src/Xmobar/Plugins/StdinReader.hs')
-rw-r--r--src/Xmobar/Plugins/StdinReader.hs7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/Xmobar/Plugins/StdinReader.hs b/src/Xmobar/Plugins/StdinReader.hs
index 4d5c438..c1e2724 100644
--- a/src/Xmobar/Plugins/StdinReader.hs
+++ b/src/Xmobar/Plugins/StdinReader.hs
@@ -27,7 +27,6 @@ import System.IO
import System.IO.Error (isEOFError)
import Xmobar.Run.Exec
import Xmobar.X11.Actions (stripActions)
-import Control.Concurrent (threadDelay)
import Control.Exception
import Control.Monad (forever)
@@ -45,15 +44,11 @@ instance Exec StdinReader where
-- there'd be a pileup of xmobars
handler (fromException -> Just e) | isEOFError e = exitImmediately ExitSuccess
-- any other exception, like "invalid argument (invalid byte sequence)",
- -- is logged to both stderr and the bar itself, throttled to avoid
- -- excessive CPU usage whenever someone pipes garbage into xmobar, and
- -- then discarded without terminating, so a single charset error doesn't
- -- break the entire xmobar
+ -- is logged to both stderr and the bar itself
handler e = do
let errorMessage = "xmobar: Received exception " <> show e
hPutStrLn stderr errorMessage
cb $ stripActions errorMessage
- threadDelay 1000000
escape :: StdinReader -> String -> String
escape StdinReader = stripActions