aboutsummaryrefslogtreecommitdiff
path: root/swaybar/bar.c
diff options
context:
space:
mode:
authorScott Anderson <scott@anderso.nz>2018-04-21 14:39:46 +1200
committerScott Anderson <scott@anderso.nz>2018-04-21 14:39:46 +1200
commit2ebb6073b7eb052984008110e3df4469d2d9c596 (patch)
treef4bc9cbc1bd399da7ab0ee499a2c9285da32de5b /swaybar/bar.c
parent9a3fb33e33b2503809d9d3a1b0d10c21bc112a80 (diff)
Remove status command event on error
This prevents very high CPU load when the status command dies, and poll continuously awoken with POLLHUP.
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r--swaybar/bar.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index d51c4ec7..10a840cc 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -418,7 +418,11 @@ static void ipc_in(int fd, short mask, void *_bar) {
static void status_in(int fd, short mask, void *_bar) {
struct swaybar *bar = (struct swaybar *)_bar;
- if (status_handle_readable(bar->status)) {
+ if (mask & (POLLHUP | POLLERR)) {
+ status_error(bar->status, "[error reading from status command]");
+ render_all_frames(bar);
+ remove_event(fd);
+ } else if (status_handle_readable(bar->status)) {
render_all_frames(bar);
}
}