Don't dup2() the parent's stdout to child's stdin.
There're DLOG()s, seriously.
This commit is contained in:
parent
58e68940f6
commit
18148205b6
|
@ -57,6 +57,8 @@ parser_ctx parser_context;
|
||||||
struct statusline_head statusline_head = TAILQ_HEAD_INITIALIZER(statusline_head);
|
struct statusline_head statusline_head = TAILQ_HEAD_INITIALIZER(statusline_head);
|
||||||
char *statusline_buffer = NULL;
|
char *statusline_buffer = NULL;
|
||||||
|
|
||||||
|
int child_stdin;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stop and free() the stdin- and sigchild-watchers
|
* Stop and free() the stdin- and sigchild-watchers
|
||||||
*
|
*
|
||||||
|
@ -359,9 +361,8 @@ void child_write_output(void) {
|
||||||
const unsigned char *output;
|
const unsigned char *output;
|
||||||
size_t size;
|
size_t size;
|
||||||
yajl_gen_get_buf(gen, &output, &size);
|
yajl_gen_get_buf(gen, &output, &size);
|
||||||
fwrite(output, 1, size, stdout);
|
write(child_stdin, output, size);
|
||||||
fwrite("\n", 1, 1, stdout);
|
write(child_stdin, "\n", 1);
|
||||||
fflush(stdout);
|
|
||||||
yajl_gen_clear(gen);
|
yajl_gen_clear(gen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,7 +431,7 @@ void start_child(char *command) {
|
||||||
close(pipe_out[0]);
|
close(pipe_out[0]);
|
||||||
|
|
||||||
dup2(pipe_in[0], STDIN_FILENO);
|
dup2(pipe_in[0], STDIN_FILENO);
|
||||||
dup2(pipe_out[1], STDOUT_FILENO);
|
child_stdin = pipe_out[1];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue