From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.devel Subject: Re: Subprocess API. Date: Sat, 23 Sep 2017 15:19:37 +0100 Message-ID: <20170923151937.5bb7d80e@bother.homenet> References: <87a81llos5.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1506176390 27329 195.159.176.226 (23 Sep 2017 14:19:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Sep 2017 14:19:50 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Sep 23 16:19:45 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvlHU-0006f7-EP for guile-devel@m.gmane.org; Sat, 23 Sep 2017 16:19:44 +0200 Original-Received: from localhost ([::1]:35113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvlHb-0005hM-Uk for guile-devel@m.gmane.org; Sat, 23 Sep 2017 10:19:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvlHW-0005h9-Cf for guile-devel@gnu.org; Sat, 23 Sep 2017 10:19:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvlHT-0001U8-43 for guile-devel@gnu.org; Sat, 23 Sep 2017 10:19:46 -0400 Original-Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvlHS-0001SF-SD for guile-devel@gnu.org; Sat, 23 Sep 2017 10:19:43 -0400 Original-Received: by mail-wr0-x244.google.com with SMTP id g50so1944547wra.3 for ; Sat, 23 Sep 2017 07:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PLd4wNmNEAi/uNpBUfJRrIaU3SHPq4h94dk1q5cXNQ8=; b=kDJZgVxJTtsISPxk71ExxcAIKulU81Q9VsAIihFiylflIzIpQPjqsIiaq3wJQSaNrj cS4J0p6/pHdLiVEgDF/uGzN2Ivjfiqtkogqd1+JWcVe7Nlx3sN45VszzcTPJHiXdxctf AvXKiwK45CTyioWhp+ok+6v1s5HS5Gu70cEdXnfrfF6k5Vc8SlEN+j226o/UtGQflpdS EkC/MWmUWDkejUnzlN2QomwSUh2ZGVqoMiB/iS+mVdvSlmKU950LQHTyA62g6JfzmBkS mzZr1U/sceBrnraBuu9BF+lT2lZwxEjeW6m1vyvwI7FFZnM9lxt5RkumdtROh6XbV+BQ OTIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLd4wNmNEAi/uNpBUfJRrIaU3SHPq4h94dk1q5cXNQ8=; b=XYTV0Rkw3OeH7jDhfJKSfVnuFvK1aAQzXM5Kr4vsjSbQgOImTixJO2hZFAi4HT/ZX4 HICzt/MdxAmE9ETKuBTbZpHEF8kcTkO9jfgRoP8L8EQzC81Yb7XhVxaYfCLywandfo6n SxBTSB4Qo4lEaOnE7zbZNPilSPrW7G91ChD7pW/4BzNlfWgfWlPr+9pXoQEXR5TJNdv0 4b63to2GOCX1rjc04shQUrYeTXOsKS+FDxEYmA+xoSO8O5m3mRF74DVJf5MHAu6T4R+g Wi/1Fw+gwej35aZyQEq9NmS+N9dZ8GrTWv6l32viNCzbSWOheG7IO7fWL2oydB+rtHZV AaoQ== X-Gm-Message-State: AHPjjUjgFUO1HVZ7s+dPHWiph8ujTRz/DCxeBm8w7PEXG7G/X8lJlzcs bBjT9v/ydUQ6+kSCI7Y/6x2QEA== X-Google-Smtp-Source: AOwi7QCjUXr++1TGVnf638TQKLTp89id334kPtOrPz/TsYUhfwbycBgkv2TrYqU0V6sh25lUY1MDoA== X-Received: by 10.223.155.154 with SMTP id d26mr2022499wrc.149.1506176380130; Sat, 23 Sep 2017 07:19:40 -0700 (PDT) Original-Received: from bother.homenet ([95.151.180.102]) by smtp.gmail.com with ESMTPSA id b58sm2491193wrg.86.2017.09.23.07.19.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Sep 2017 07:19:39 -0700 (PDT) Original-Received: from bother.homenet (localhost [IPv6:::1]) by bother.homenet (Postfix) with ESMTP id 0E64F2632B9 for ; Sat, 23 Sep 2017 15:19:38 +0100 (BST) In-Reply-To: <87a81llos5.fsf@gmail.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19312 Archived-At: On Sat, 23 Sep 2017 11:58:34 +0200 Mathieu Othacehe wrote: > Hi, > > I recently used "open-pipe*" to launch a process but was unable to > read from stderr. This subject was already discussed on this ml > here : > > https://lists.gnu.org/archive/html/guile-user/2015-04/msg00003.html > > Racket seems to have procedures to provide stdout/stdin/stderr ports > for a given subprocess[1]. > > Mark, you said this subject was on your TODO list, is there anything > available or would it be possible to develop a racket like API ? The run-concurrently+ procedure in guile-lib ( http://www.nongnu.org/guile-lib/doc/ref/os.process/ ) should do what you want. Construct a pipe with guile's POSIX 'pipe' procedure and pass the write port to the run-concurrently+ procedure for file descriptor 2 (stderr) and then read from the read port. Close the write port on the reader side before reading so that when the sub-process ends, the read will return with an eof-object. This works exactly as you would expect from its POSIX equivalents and has the advantage that you can read from the pipe as the sub-process is proceeding rather than just collect at the end. Having said that it would be nice to have this in more formalized form in guile itself, say something along the lines of ocaml's Unix.create_process function. Cjros