From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Two way pipe Date: Thu, 26 Apr 2007 14:25:05 +0200 Organization: LAAS-CNRS Message-ID: <87y7kfnx0e.fsf@laas.fr> References: <87k5vz7fsb.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1177590305 7291 80.91.229.12 (26 Apr 2007 12:25:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2007 12:25:05 +0000 (UTC) Cc: Guile Users To: Neil Jerram Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Apr 26 14:25:03 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hh31y-0007sf-SZ for guile-user@m.gmane.org; Thu, 26 Apr 2007 14:25:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hh37i-0004O9-3i for guile-user@m.gmane.org; Thu, 26 Apr 2007 08:30:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hh37d-0004O1-90 for guile-user@gnu.org; Thu, 26 Apr 2007 08:30:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hh37b-0004Nj-Re for guile-user@gnu.org; Thu, 26 Apr 2007 08:30:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hh37b-0004Nc-It for guile-user@gnu.org; Thu, 26 Apr 2007 08:30:51 -0400 Original-Received: from laas.laas.fr ([140.93.0.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1Hh31r-0004eU-Db for guile-user@gnu.org; Thu, 26 Apr 2007 08:24:55 -0400 Original-Received: from messiaen.laas.fr (messiaen [IPv6:2001:660:6602:0:230:65ff:fed4:9d20]) by laas.laas.fr (8.13.8/8.13.8) with SMTP id l3QCOp5p017905; Thu, 26 Apr 2007 14:24:51 +0200 (MEST) Original-Received: by messiaen.laas.fr (sSMTP sendmail emulation); Thu, 26 Apr 2007 14:25:06 +0200 X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 7 =?iso-8859-1?Q?Flor=E9al?= an 215 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Neil Jerram , Guile Users In-Reply-To: <87k5vz7fsb.fsf@ossau.uklinux.net> (Neil Jerram's message of "Thu, 26 Apr 2007 08:31:32 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Spam-Score: -0.001 () NO_RELAYS X-Scanned-By: MIMEDefang at CNRS-LAAS on IPv6:2001:660:6602::2 X-detected-kernel: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5929 Archived-At: Hi Neil, Neil Jerram writes: > Is there any technical reason for why (ice-9 popen) only provides one > way pipes? In other words, you can either write to the subprocess, or > read from it, but not both. Are there extra technical difficulties > involved with a two way pipe? Doesn't `OPEN_BOTH' do what you want? However, the manual reads: Care should be taken with `OPEN_BOTH', a deadlock will occur if both parent and child are writing, and waiting until the write completes before doing any reading. Each direction has `PIPE_BUF' bytes of buffering (*note Ports and File Descriptors::), which will be enough for small writes, but not for say putting a big file through a filter. A socket pair might be suitable, too. > I have a current requirement to create a subprocess (mplayer in slave > mode) and then both write to and read from it. And it seems to me > that this kind of requirement probably isn't uncommon. > > Telford Tendys once posted a possible implementation of this at > http://www.red-bean.com/guile/guile/old/3038.html. Can anyone see any > problems with that implementation? No, it looks nice. :-) It could potentially suffer from the deadlock issue as well, but since communication with a terminal (via SSH) follows a simple pattern (write command, read result), I guess deadlocks are unlikely. Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user