Taking Control of stdin/stdout of a slave process
Doug Gwyn
gwyn at smoke.brl.mil
Mon Mar 18 10:22:48 AEST 1991
In article <1991Mar14.140749.24337 at cm.cf.ac.uk> bharat at cf-cm.computing-maths.cardiff.ac.uk (Bharat Mediratta) writes:
-In article <1991Mar13.163756.26785 at evax.arl.utexas.edu> rduff at evax.arl.utexas.edu (Robert Duff) writes:
->I am interested in starting a UNIX process from a program and having the
->slave process' stdin and stdout piped through FILE*'s in the master process.
->I have worked with popen(), but that only allows one-way piping.
->How can I get both directions piped to my controller process?
-[attempted solution deleted]
-This ought to do the trick. Writing to 'to_slave' will
-send bytes to the slave process, and reading from 'from_slave'
-will read the output from the slave process.
The fellow said FILE*s, but in any case there is a fundamental problem
with the request that has no simple solution. Namely, deadlock can
easily occur in such a scenario. Only with a carefully-designed
communication protocol can one have confidence that deadlock will not
occur. That requires support on the slave end as well as the master,
so the slave cannot be an arbitrary process.
I would suggest reconsidering the request to see what it is that is
REALLY wanted, before wasting time on inadequate solutions.
More information about the Comp.unix.wizards
mailing list