| 31 | } |
| 32 | |
| 33 | static void capture_start(void) { |
| 34 | fflush(stderr); |
| 35 | saved_stderr = dup(STDERR_FILENO); |
| 36 | cbm_pipe(pipe_fds); |
| 37 | #ifndef _WIN32 |
| 38 | /* Set read end to non-blocking */ |
| 39 | fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK); |
| 40 | #endif |
| 41 | dup2(pipe_fds[1], STDERR_FILENO); |
| 42 | close(pipe_fds[1]); |
| 43 | } |
| 44 | |
| 45 | static const char *capture_end(void) { |
| 46 | fflush(stderr); |