Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!labrea!csli!gandalf From: gandalf@csli.STANFORD.EDU (Juergen Wagner) Newsgroups: comp.unix.questions Subject: Unix does work! (Was: Unix doesn't work !) Message-ID: <8283@csli.STANFORD.EDU> Date: 25 Mar 89 21:52:31 GMT References: <407@retix.retix.COM> Sender: gandalf@csli.Stanford.EDU (Juergen Wagner) Reply-To: gandalf@csli.stanford.edu (Juergen Wagner) Organization: Center for the Study of Language and Information, Stanford U. Lines: 17 The pipe consists of two ends, accessible through two file descriptors. When the child process is forked, there are two processes with access to the writable end. When the child exits, there is still the parent process left which could write to the pipe. Therefore, a read will hang rather than indicate EOF. TFM says: Read calls on an empty pipe (no buffered data) with only one end (all write file descriptors closed) returns an end-of- file. I suggest that you close the unused fds in the parent process, and your program should work. -- Juergen Wagner gandalf@csli.stanford.edu wagner@arisia.xerox.com