Wait for the child process to exit on its own before freeing
watcher-related resources.
i3bar shows the last received status line until the process exits.
Fixes a race condition where the termination signal was sometimes not
received to display a meaningful error message.
/*
* Helper function to read stdin
*
+ * Returns NULL on EOF.
+ *
*/
static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) {
int fd = watcher->fd;
exit(EXIT_FAILURE);
}
if (n == 0) {
- /* end of file, kill the watcher */
ELOG("stdin: received EOF\n");
- cleanup();
*ret_buffer_len = -1;
return NULL;
}