Remove status command event on error

This prevents very high CPU load when the status command dies,
and poll continuously awoken with POLLHUP.
This commit is contained in:
Scott Anderson 2018-04-21 14:39:46 +12:00
parent 9a3fb33e33
commit 2ebb6073b7

View file

@ -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);
}
}