i3 - improved tiling WM


Don't dup2() the parent's stdout to child's stdin.

Patch status: merged

Patch by Yuxuan Shui

Long description:

There're DLOG()s, seriously.

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

b/i3bar/src/child.c

14
@@ -57,6 +57,8 @@ parser_ctx parser_context;
15
 struct statusline_head statusline_head = TAILQ_HEAD_INITIALIZER(statusline_head);
16
 char *statusline_buffer = NULL;
17
 
18
+int child_stdin;
19
+
20
 /*
21
  * Stop and free() the stdin- and sigchild-watchers
22
  *
23
@@ -359,9 +361,8 @@ void child_write_output(void) {
24
         const unsigned char *output;
25
         size_t size;
26
         yajl_gen_get_buf(gen, &output, &size);
27
-        fwrite(output, 1, size, stdout);
28
-        fwrite("\n", 1, 1, stdout);
29
-        fflush(stdout);
30
+        write(child_stdin, output, size);
31
+        write(child_stdin, "\n", 1);
32
         yajl_gen_clear(gen);
33
     }
34
 }
35
@@ -430,7 +431,7 @@ void start_child(char *command) {
36
                 close(pipe_out[0]);
37
 
38
                 dup2(pipe_in[0], STDIN_FILENO);
39
-                dup2(pipe_out[1], STDOUT_FILENO);
40
+                child_stdin = pipe_out[1];
41
 
42
                 break;
43
         }