From 7bdb2d4ce2afc20b3dfd744b4b85373aa8354483 Mon Sep 17 00:00:00 2001 From: "K. Noel Belcourt" Date: Tue, 30 Nov 2010 21:09:23 +0000 Subject: [PATCH] Non-blocking file descriptors for un*x bjam. [SVN r66920] --- v2/engine/src/execunix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2/engine/src/execunix.c b/v2/engine/src/execunix.c index effd27138..ef9dba003 100644 --- a/v2/engine/src/execunix.c +++ b/v2/engine/src/execunix.c @@ -258,6 +258,10 @@ void exec_cmd close( out[1] ); close( err[1] ); + /* set both file descriptors to non-blocking */ + fcntl(out[0], F_SETFL, O_NONBLOCK); + fcntl(err[0], F_SETFL, O_NONBLOCK); + /* child writes stdout to out[1], parent reads from out[0] */ cmdtab[ slot ].fd[ OUT ] = out[0]; cmdtab[ slot ].stream[ OUT ] = fdopen( cmdtab[ slot ].fd[ OUT ], "rb" );