Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!seismo!mcvax!diku!thorinn From: thorinn@diku.UUCP Newsgroups: comp.bugs.4bsd,comp.unix.wizards Subject: Re: ex doesn't wait for all its children Message-ID: <2931@diku.UUCP> Date: Mon, 19-Jan-87 10:53:53 EST Article-I.D.: diku.2931 Posted: Mon Jan 19 10:53:53 1987 Date-Received: Sun, 1-Feb-87 16:04:28 EST References: <10069@tektronix.TEK.COM> Organization: DIKU, U of Copenhagen, DK Lines: 17 Keywords: wait zombie Xref: watmath comp.bugs.4bsd:164 comp.unix.wizards:778 In article <10069@tektronix.TEK.COM> tonyb@tektronix.TEK.COM (Tony Birnseth) writes: > The only change that was really necessary was to add a call > to waitfor() after the call to setrupt() if forking to write the 'io' > stream. > Of course it's entirely possible that I'm missing something here. I > think the fix should be done correctly by waiting for each child after > it is created. > I think that you missed one important point: If the region written to the pipe contains more than 4K bytes, the first child won't exit if no one reads the pipe. So the correct thing would be to remember the pid of the writer and wait for it *after* the reader exits -- even if the writer didn't get every- thing into the pipe, it will get a SIGPIPE and die when the pipe is closed. -- Lars Mathiesen, DIKU, U of Copenhagen, Denmark ..mcvax!diku!thorinn Institute of Datalogy -- we're scientists, not engineers.