mirror of
https://github.com/vale981/bspwm
synced 2025-03-04 17:31:39 -05:00
Only handle stdout closure for subscribers
Thanks to @ortango for the patch. Fixes #1207.
This commit is contained in:
parent
e13255e249
commit
7aca1b6c4e
3 changed files with 9 additions and 2 deletions
|
@ -79,6 +79,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
int ret = EXIT_SUCCESS, nb;
|
||||
bool subwait = false;
|
||||
|
||||
struct pollfd fds[] = {
|
||||
{sock_fd, POLLIN, 0},
|
||||
|
@ -93,6 +94,8 @@ int main(int argc, char *argv[])
|
|||
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);
|
||||
|
@ -101,7 +104,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (fds[1].revents & (POLLERR | POLLHUP)) {
|
||||
if (subwait && fds[1].revents & (POLLERR | POLLHUP)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#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
|
||||
|
|
|
@ -1332,6 +1332,9 @@ void cmd_subscribe(char **args, int num, FILE *rsp)
|
|||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue