From mint-bounce@lists.fishpool.fi Tue Jan 22 17:26:19 2008 X-Original-To: fnaumann@mail.boerde.de Delivered-To: fnaumann@mail.boerde.de Date: Mon, 29 Oct 2007 14:59:54 +0100 (MET) From: Jo Even Skarstein To: Message-ID: <17602575.157251193666394837.JavaMail.adm-moff@moffice5.nsc.no> In-Reply-To: <4725CB62.5090907@highlandsun.com> References: <44180264.137741193650999885.JavaMail.adm-moff@moffice5.nsc.no> <4725CB62.5090907@highlandsun.com> Subject: [MiNT] SV: Redirecting stdio using Fforce/Fdup MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_15868_17488909.1193666394834" X-Priority: 3 (Normal) X-Mailer: Mobile Office v1.44 (Telenor Nordic) X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-To: mint-bounce@lists.fishpool.fi X-original-sender: joska@online.no Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: X-Virus-Scanned: by amavisd-new at relay.boerde.de X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=7.0 tests=BAYES_00 X-Spam-Level: Status: X-Status: X-Keywords: ------=_Part_15868_17488909.1193666394834 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit > From: Howard Chu [hyc@highlandsun.com] > Sent: 2007-10-29 13:00:34 CET > > Those functions are pretty much the same as Unix dup/dup2 system calls. You > first create a pipe, then Fforce the child's stdout/stderr to write to the > pipe. Your parent process then reads the pipe to get all of the child's > output. If you also need to feed input to the child, then you'll also need a > separate pipe for that, and Fforce it to the child's stdin. Something like this? in = Fpipe() out = Fpipe() Fforce(STDIN, in) Fforce(STDOUT, out) Pexec(100,"old_shit.tos", 0, 0) Communicate with the child here using the in/out pipes. Fclose the pipes and restore stdin and stdout when the child exits. Btw. is this necessary? If I don't close the pipes when the child exits, will stdin/stdout of the next child I Pexec be redirected? I don't intend to run several childs concurrently, but I might need to run several in sequence. Jo Even ------=_Part_15868_17488909.1193666394834--