Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.unix.questions Subject: Re: fork question Message-ID: <1991Feb7.005148.19348@Think.COM> Date: 7 Feb 91 00:51:48 GMT References: Sender: news@Think.COM Distribution: comp Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 20 In article davis@pacific.mps.ohio-state.edu (John E. Davis) writes: >As you can see, the program forks with the parent exiting returning the pid of >the child process. This is precisely what happens when I run it at the unix >command line. Now in my .login I have the line: >set slinepid = `sline` >which sets the variable `slinepid' to the pid of the child. This variable >gets set but my .login gets hung up here-- ie. it does not continue beyond >this point; I have to ^C to kill it. > >What fundamental point am I missing here? It seems to me that the .login is >waiting for the child to exit as well. The child process has to close its stdout. The problem is that the shell is reading the pipe until it gets an EOF, and that doesn't happen until all the processes on the other end of the pipe have closed it. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar