Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.unix.wizards Subject: Re: Taking Control of stdin/stdout of a slave process Message-ID: <15500@smoke.brl.mil> Date: 18 Mar 91 00:22:48 GMT References: <1991Mar13.163756.26785@evax.arl.utexas.edu> <1991Mar14.140749.24337@cm.cf.ac.uk> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 20 In article <1991Mar14.140749.24337@cm.cf.ac.uk> bharat@cf-cm.computing-maths.cardiff.ac.uk (Bharat Mediratta) writes: -In article <1991Mar13.163756.26785@evax.arl.utexas.edu> rduff@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.