diff --git a/src/sink.c b/src/sink.c index f3e18ccb2..214b272ef 100644 --- a/src/sink.c +++ b/src/sink.c @@ -19,6 +19,8 @@ */ #include +#include +#include #include #include #include @@ -89,6 +91,11 @@ struct sink *sink_new_fd(const char *name, const char *desc, enum sink_fmt fmt, goto end; } + /* FD not yet initialized to non-blocking mode. + * DON'T DO IT ON A TERMINAL! + */ + if (!isatty(fd)) + fcntl(fd, F_SETFL, O_NONBLOCK); sink->type = SINK_TYPE_FD; sink->ctx.fd = fd; end: