redirecting standard i/o from an exec'ed programme

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Aug 15 23:29:21 AEST 1990


In article <377 at fe2o3.UUCP> michael at 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.



More information about the Comp.unix.questions mailing list