From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KK91NZtDt2JzPwEAbAwnHQ (envelope-from ) for ; Sat, 25 Jun 2022 19:19:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YGBQNZtDt2LNhgAAauVa8A (envelope-from ) for ; Sat, 25 Jun 2022 19:19:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7624630F4F for ; Sat, 25 Jun 2022 19:19:19 +0200 (CEST) Received: from localhost ([::1]:60974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o59RG-00010f-Cc for larch@yhetil.org; Sat, 25 Jun 2022 13:19:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o59R0-00010W-Pt for guix-patches@gnu.org; Sat, 25 Jun 2022 13:19:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o59R0-00040u-Hf for guix-patches@gnu.org; Sat, 25 Jun 2022 13:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o59R0-0006mN-BD for guix-patches@gnu.org; Sat, 25 Jun 2022 13:19:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56218] [PATCH] guix: inferior: Fix the behaviour of open-inferior #:error-port. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Jun 2022 17:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56218 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56218@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165617753426039 (code B ref -1); Sat, 25 Jun 2022 17:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jun 2022 17:18:54 +0000 Received: from localhost ([127.0.0.1]:46155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o59Qs-0006lv-By for submit@debbugs.gnu.org; Sat, 25 Jun 2022 13:18:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:40238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o59Qp-0006ll-Va for submit@debbugs.gnu.org; Sat, 25 Jun 2022 13:18:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o59Qp-00010N-Q8 for guix-patches@gnu.org; Sat, 25 Jun 2022 13:18:51 -0400 Received: from mira.cbaines.net ([212.71.252.8]:36428) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o59Qo-00040D-84 for guix-patches@gnu.org; Sat, 25 Jun 2022 13:18:51 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:54d1:d5d4:280e:f699]) by mira.cbaines.net (Postfix) with ESMTPSA id ED17E27BBE9 for ; Sat, 25 Jun 2022 18:18:47 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 1fba1de2 for ; Sat, 25 Jun 2022 17:18:47 +0000 (UTC) From: Christopher Baines Date: Sat, 25 Jun 2022 18:18:47 +0100 Message-Id: <20220625171847.29104-1-mail@cbaines.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656177559; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MfrwELAxqXw6zrr3jIsQkx/WR42ZFhXtNBdhtd7WgNo=; b=t05pq6rfncofs++tWGVw9f4GKm9WDhMTEoDmb40x5kNDnq18WM+WpdnnbqMRQj2aBgvTiF qNfJPgC8dJD3pMWjJVvcpOzKqWJvreRSFx7NokD0We020AX1B+Hi1ctXhi90u+vEWpTYZd PEcVvjSh5q0T9wBcgF/rfx5ouy+Ey8DULTldqnEtJEEJpcxyxTQRGhIj/VskYu2U+Kn+F5 /ZI0+Khj8fQLoPFaxwXn7gJl52P/oNJSVdRJIkVTS7RZTaRjK44y66OAKWXEbUgNIQcKyf he26cqfpP4m5Y6ikbK1PVrPZJZKmHBF81OkEBDy8qec0A8WIWu54245RXIa93w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656177559; a=rsa-sha256; cv=none; b=DuJWy+BnuXFm3Htcja67viby0saGoodGUf2Q0w58wgukVh2QH4nPGmxPu59x/VZthry1b3 Z2ruXCqSO3MFKfwfohtKhN1xyos6WeTH77SUaodcBeyDnYzO82HZLPbRPRBMxzgiLDbJrw 2dpW3Z1eriqJOGAOsVFsmIbPgDXcB2wsjpqk8Zh+BaP8F5hsaUsi2Y2AsswQYv7pHI4xW/ TfCV9MmdCDCF3pySJ9bIaM8pA52h3OZoPLSk8fyeB5VsNuJPyPQ2btyn0cqihnIKMlIXeU 2Tf7XvRJmSWc9mS8eg0BGS9Dejq1QIlxHgRLGbJcumHfdWZmF4gdrHo5BC6dHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.26 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7624630F4F X-Spam-Score: -1.26 X-Migadu-Scanner: scn0.migadu.com X-TUID: lqYeKRsYOhtM This should be the error port used by the inferior process, but currently it's either stderr if #:error-port is a file port, or /dev/null otherwise. I'm looking at this as the Guix Data Service uses this behaviour to record and display logs from inferior processes. * guix/inferior.scm (open-bidirectional-pipe): Call dup2 for file descriptor 2, passing either the file number for the current error port, or a file descriptor for /dev/null. --- guix/inferior.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 54200b75e4..e36806ac84 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -156,12 +156,14 @@ (define (open-bidirectional-pipe command . args) (close-port parent) (close-fdes 0) (close-fdes 1) + (close-fdes 2) (dup2 (fileno child) 0) (dup2 (fileno child) 1) ;; Mimic 'open-pipe*'. - (unless (file-port? (current-error-port)) - (close-fdes 2) - (dup2 (open-fdes "/dev/null" O_WRONLY) 2)) + (dup2 (if (file-port? (current-error-port)) + (fileno (current-error-port)) + (open-fdes "/dev/null" O_WRONLY)) + 2) (apply execlp command command args)) (lambda () (primitive-_exit 127)))) -- 2.36.1