Thanks to @ortango for the patch.
Fixes #1207.
}
int ret = EXIT_SUCCESS, nb;
+ bool subwait = false;
struct pollfd fds[] = {
{sock_fd, POLLIN, 0},
ret = EXIT_FAILURE;
fprintf(stderr, "%s", rsp + 1);
fflush(stderr);
+ } else if (rsp[0] == SUBSCRIBE_MESSAGE[0]) {
+ subwait = true;
} else {
fprintf(stdout, "%s", rsp);
fflush(stdout);
break;
}
}
- if (fds[1].revents & (POLLERR | POLLHUP)) {
+ if (subwait && fds[1].revents & (POLLERR | POLLHUP)) {
break;
}
}
#define SOCKET_PATH_TPL "/tmp/bspwm%s_%i_%i-socket"
#define SOCKET_ENV_VAR "BSPWM_SOCKET"
-#define FAILURE_MESSAGE "\x07"
+#define FAILURE_MESSAGE "\x07"
+#define SUBSCRIBE_MESSAGE "\x08"
#endif
perror("subscribe: fopen");
goto free_fifo_path;
}
+ } else {
+ fprintf(rsp, SUBSCRIBE_MESSAGE);
+ fflush(rsp);
}
subscriber_list_t *sb = make_subscriber(stream, fifo_path, field, count);