diff options
author | Tomas Janousek <tomi@nomi.cz> | 2017-11-04 20:07:30 +0100 |
---|---|---|
committer | Tomas Janousek <tomi@nomi.cz> | 2018-04-05 10:45:19 +0200 |
commit | 3b88faefe7a2a512ebf2dcde4f3cdb3e89b98393 (patch) | |
tree | 8c6b4694c3c70e3b5f2d886e9558b734cb69cd34 /src/Plugins/Monitors/Common.hs | |
parent | 40fd9dfe82a734057640b4495ed5d8d93531c4fc (diff) | |
download | xmobar-3b88faefe7a2a512ebf2dcde4f3cdb3e89b98393.tar.gz xmobar-3b88faefe7a2a512ebf2dcde4f3cdb3e89b98393.tar.bz2 |
Net: fix race condition in netParser/readNetDev/isUp
It's possible (and happens) that netParser sees a device that is no
longer there when we get to isUp. This happens almost every time I
resume from suspend and the WWAN card (USB device) reappears, and
results in xmobar showing the exception until I restart it.
Originally I tried
tryJust (guard . isDoesNotExistError) (B.readFile (operstateDir d))
and it worked for a while but in recent kernels it's possible to open
the file and have the device disappear before we get to reading the
contents of it, so we need to surround the whole open/read block in
catchIOError and make sure it's evaluated.
Diffstat (limited to 'src/Plugins/Monitors/Common.hs')
0 files changed, 0 insertions, 0 deletions