Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!mailrus!bbn!diamond.bbn.com!mlandau From: mlandau@bbn.com (Matt Landau) Newsgroups: comp.unix.wizards Subject: Re: bug in pclose(3) Message-ID: <12407@jade.BBN.COM> Date: 20 Dec 88 19:27:53 GMT References: <261@ecijmm.UUCP> Reply-To: mlandau@bbn.com (Matt Landau) Organization: BBN Systems and Technologies Corporation, Cambridge, MA Lines: 16 [Earlier article describes some race conditions that can lead to program hanging if they popen() multiple things and then close them in a certain order. . .] I've found the same sort of behavior in BSD-derived systems, with both popen and system. The basic problem is that in both cases, the library routines will wait for the process they're interested in to terminate, but will catch and discard termination information for other processes silently. The only completely reliable solution for our application turned out to be the rule "don't use popen/pclose or system for general process control functions." Instead, we wrote a set of library routines to manage multiple child processes cleanly - they know how to start, send input to, get input from, and kill any of the set of running children without affecting the others.