i3 - improved tiling WM


i3bar: Do not kill watcher on EOF

Patch status: merged

Patch by Tony Crisci

Long description:

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.

To apply this patch, use:
curl http://cr.i3wm.org/patch/423/raw.patch | git am

b/i3bar/src/child.c

20
@@ -266,6 +266,8 @@ static int stdin_end_array(void *context) {
21
 /*
22
  * Helper function to read stdin
23
  *
24
+ * Returns NULL on EOF.
25
+ *
26
  */
27
 static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) {
28
     int fd = watcher->fd;
29
@@ -285,9 +287,7 @@ static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) {
30
             exit(EXIT_FAILURE);
31
         }
32
         if (n == 0) {
33
-            /* end of file, kill the watcher */
34
             ELOG("stdin: received EOF\n");
35
-            cleanup();
36
             *ret_buffer_len = -1;
37
             return NULL;
38
         }