Path: utzoo!attcan!uunet!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: redirecting standard i/o from an exec'ed programme Keywords: popen, io, exec, system Message-ID: <13560@smoke.BRL.MIL> Date: 15 Aug 90 13:29:21 GMT References: <377@fe2o3.UUCP> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article <377@fe2o3.UUCP> michael@fe2o3.UUCP (Michael Katzmann) writes: >which execs the command a la "system()" and creates a pipe. "type" and be >"r" if you want to read from the standard output of "command", or "w" if >you want to write to standard input. However there doesn't seem to be any >way to use this routine to do both similtaneously. >What is the usual way to to this? This should probably be added the the FAQ list. The problem with trying to pipe both input and output to an arbitrary slave process is that deadlock can occur, if both processes are waiting for not-yet-generated input at the same time. Deadlock can be avoided only by having BOTH sides follow a strict deadlock-free protocol, but since that requires cooperation from the processes it is inappropriate for a popen()-like library function.