From patchwork Wed Oct 2 18:28:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 15581 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8C177174A7; Wed, 2 Oct 2019 19:29:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 45AC8174A2 for ; Wed, 2 Oct 2019 19:29:11 +0100 (BST) Received: from localhost ([::1]:58410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFjN8-0004oS-Pk for patchwork@mira.cbaines.net; Wed, 02 Oct 2019 14:29:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48079) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFjN1-0004ny-CR for guix-patches@gnu.org; Wed, 02 Oct 2019 14:29:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFjMz-00041O-Vm for guix-patches@gnu.org; Wed, 02 Oct 2019 14:29:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFjMz-00041J-SD for guix-patches@gnu.org; Wed, 02 Oct 2019 14:29:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iFjMz-0007L4-Ht for guix-patches@gnu.org; Wed, 02 Oct 2019 14:29:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37587] [PATCH 1/2] inferior: Allow controlling the inferior error port. References: <87bluzovp5.fsf@cbaines.net> In-Reply-To: <87bluzovp5.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Oct 2019 18:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37587 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37587@debbugs.gnu.org Received: via spool by 37587-submit@debbugs.gnu.org id=B37587.157004090028148 (code B ref 37587); Wed, 02 Oct 2019 18:29:01 +0000 Received: (at 37587) by debbugs.gnu.org; 2 Oct 2019 18:28:20 +0000 Received: from localhost ([127.0.0.1]:38286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFjMJ-0007Jv-U5 for submit@debbugs.gnu.org; Wed, 02 Oct 2019 14:28:20 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFjMH-0007Jg-FM for 37587@debbugs.gnu.org; Wed, 02 Oct 2019 14:28:18 -0400 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 5F8C3174A2 for <37587@debbugs.gnu.org>; Wed, 2 Oct 2019 19:28:16 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 02515324 for <37587@debbugs.gnu.org>; Wed, 2 Oct 2019 18:28:16 +0000 (UTC) From: Christopher Baines Date: Wed, 2 Oct 2019 19:28:15 +0100 Message-Id: <20191002182816.14051-1-mail@cbaines.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Previously, stderr for the inferior process would always be sent to /dev/null because the current-output-port when the process is launched is a void port. This change means that it's possible to pass in a different port to use. * guix/inferior.scm (inferior-pipe): Take the error-port as an argument. (open-inferior): Add new error-port keyword argument, with a default of (%make-void-port "w"). --- guix/inferior.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index d6d2053ab8..eecdbdd5ca 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -110,11 +110,11 @@ (packages inferior-package-promise) ;promise of inferior packages (table inferior-package-table)) ;promise of vhash -(define (inferior-pipe directory command) +(define* (inferior-pipe directory command error-port) "Return an input/output pipe on the Guix instance in DIRECTORY. This runs 'DIRECTORY/COMMAND repl' if it exists, or falls back to some other method if it's an old Guix." - (let ((pipe (with-error-to-port (%make-void-port "w") + (let ((pipe (with-error-to-port error-port (lambda () (open-pipe* OPEN_BOTH (string-append directory "/" command) @@ -161,11 +161,13 @@ inferior." (_ #f))) -(define* (open-inferior directory #:key (command "bin/guix")) +(define* (open-inferior directory + #:key (command "bin/guix") + (error-port (%make-void-port "w"))) "Open the inferior Guix in DIRECTORY, running 'DIRECTORY/COMMAND repl' or equivalent. Return #f if the inferior could not be launched." (define pipe - (inferior-pipe directory command)) + (inferior-pipe directory command error-port)) (port->inferior pipe close-pipe))