[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fclose



On Sat, 11 Feb 1995, Axel Kaiser wrote:

> Hi,
> 
> here is a, as I fear, silly question. When oppening a pipe
> and using its handle for redirecting the standard handles,
> what is the exact effect of closing the handle of the pipe?
> Is it useful/necessary/forbidden to close the handle before
> exec-uting a child process? 

	Close the pipe _after_ executing the child. Ideally, run the 
processes in parallel, and close the pipe after starting them. A SIGPIPE 
is sent when one end of the pipe has no more handles open to read it (or 
write it, depending on which end). SIGPIPE kills the process, by default, 
so you always one to have one handle open at each end, until you are 
finished with it. Using a named pipe, works a little differently.

Dancer

--
---------------------------------------------------------------------------
|   /----\   |GAT -d++()(--)>!d H s++: g+ p1+ !au a-? w+++(--)
|  /  //  \  |v---(-)*(++) c+++@>$ U?++++$>B++++$>S++++$ P+(-) L- 3-
| |  //  //| |E--- N++(+++) K W---() M(+) V--@ -po+(--@)(++@) Y+ t(+++@)
| | //  // | |!5 !j R+++()>$ G+ tv(-) b+++ !D B(-) e u++(*)
|  \/  // /  |h++(-)(---)>*$ f+(?) r--@(+++@) n----(--) y+++(++@)>*>**
|   \----/   |-------------------------------------------------------------
|            |   dancer@ozspace.brisnet.org.au
---------------------------------------------------------------------------