From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wI/kJTtbDWL/YAEAgWs5BA (envelope-from ) for ; Wed, 16 Feb 2022 21:14:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eBh6IjtbDWLWQwAAauVa8A (envelope-from ) for ; Wed, 16 Feb 2022 21:14:51 +0100 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 124413CDEC for ; Wed, 16 Feb 2022 21:14:51 +0100 (CET) Received: from localhost ([::1]:58666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKQhO-0004Ws-5r for larch@yhetil.org; Wed, 16 Feb 2022 15:14:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKPU6-0000wf-ID for guix-patches@gnu.org; Wed, 16 Feb 2022 13:57:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKPU6-0005ug-8P for guix-patches@gnu.org; Wed, 16 Feb 2022 13:57:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKPU6-0006P8-8k for guix-patches@gnu.org; Wed, 16 Feb 2022 13:57:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54029] [PATCH] allow user to force color when not a tty Resent-From: Phil Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Feb 2022 18:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54029 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54029@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164503777424556 (code B ref -1); Wed, 16 Feb 2022 18:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Feb 2022 18:56:14 +0000 Received: from localhost ([127.0.0.1]:49465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKPTJ-0006Nz-UH for submit@debbugs.gnu.org; Wed, 16 Feb 2022 13:56:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:37188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKP2A-0005dO-Be for submit@debbugs.gnu.org; Wed, 16 Feb 2022 13:28:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKP2A-00081w-63 for guix-patches@gnu.org; Wed, 16 Feb 2022 13:28:10 -0500 Received: from [2a00:1450:4864:20::329] (port=45922 helo=mail-wm1-x329.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKP28-0000qG-Fa for guix-patches@gnu.org; Wed, 16 Feb 2022 13:28:09 -0500 Received: by mail-wm1-x329.google.com with SMTP id az26-20020a05600c601a00b0037c078db59cso2261725wmb.4 for ; Wed, 16 Feb 2022 10:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beadling-co-uk.20210112.gappssmtp.com; s=20210112; h=user-agent:from:to:subject:message-id:date:mime-version; bh=3mrleFCQUki3qxvKAPv+GcMFozys9ISVmfjXBJnq9z4=; b=KR3iiFVa1rci2o2T+P9lw2/8GUVha431re6C4Mj/ZTfOGcMDDyLiVyFeDi35D5SGrA Xsq6jg+S9/RrgVNMhnBNbgZMrwg31nXDszii28Csh/sdeZ0I0MUJbvvpOB8RmeTQ/SJr tV1g/IRLGvzkcAo31tC1883/yMHvTyZpgca1Qth+ROpaBD++Jak2yhO/VYwLdD86qgK+ Mu2nln01CfeSTpYFNeGM1NFbenrHImZ+kmCEDX3ehFI2P4PT9lyQyiB8gs/uHtgAHdre QVREO1QSRHXJqE3q7Hf31DGPD4/Kpq2Blaq0Qc91EhTEH3ODdAKJ7gCAYVNIcDGstlsK DEDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:user-agent:from:to:subject:message-id:date :mime-version; bh=3mrleFCQUki3qxvKAPv+GcMFozys9ISVmfjXBJnq9z4=; b=C/i6a8UP9rmaoykBeQjEdUsG0QtTonkbiirzrdcWL4sZUfs7+f0t43ED4R6wQCvOVC pfb7Wu/EddBHWbc7jcdz1sAl7SH4FuKVNoAh1boPj69Lasg4EqpfizLDOBdLnFoN+Lw5 5UbA7c48sySjzbM40TWfosh6rMSQRlhwp8CI7R1/FSTdrtc/kkJWzmpkZ9BdgdAAnLDG HM04z8Id0/lXATF0MGQ9SvzXBDGBRTbzd9SrdjDpqRc0YKnVRbxcm2FxPR/VUhQc19PZ oP1ZCuysuGxRqJcGNdE2TmgRMmgFq79d4Fa1PeZeHW3MYLEX42k9aPkhI+CjlmnFlLx4 Z7aQ== X-Gm-Message-State: AOAM530EQF5bKhSDNxHUZIbz426OGg+XquWN3KrizbhJXYOEEvSYa0QB aDkJjrNiGc+INWCcc9OauM7V7peEMQGlPq3fovhAug== X-Google-Smtp-Source: ABdhPJzHo7KvJB+OmV/FKqzBr/gVbuFaDUIRF+3MhSTSrSzDlHJpwzCzVoI9xlX8b0+oI7blwfvBnw== X-Received: by 2002:a05:600c:1d20:b0:37b:b441:d8d7 with SMTP id l32-20020a05600c1d2000b0037bb441d8d7mr2804708wms.170.1645036084972; Wed, 16 Feb 2022 10:28:04 -0800 (PST) Received: from xps13 (host-92-17-247-131.as13285.net. [92.17.247.131]) by smtp.gmail.com with ESMTPSA id z5sm23504054wmp.10.2022.02.16.10.28.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 10:28:04 -0800 (PST) User-agent: mu4e 1.4.15; emacs 27.2 From: Phil Message-ID: <87wnhuekek.fsf@beadling.co.uk> Date: Wed, 16 Feb 2022 18:28:03 +0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::329 (failed) Received-SPF: none client-ip=2a00:1450:4864:20::329; envelope-from=phil@beadling.co.uk; helo=mail-wm1-x329.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.978, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 16 Feb 2022 13:56:12 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Wed, 16 Feb 2022 15:13:57 -0500 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645042491; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=3mrleFCQUki3qxvKAPv+GcMFozys9ISVmfjXBJnq9z4=; b=LIa7mQL0yRZzECy//DNLn1TSeb04v8zBHZJrOtnUiQmyUhyp/MY/N0H6nbAOTyLRx6LkQT ld3noLI2t7eApOAgHsDRqSsp6SCLF2UDep0zCgotzt/ZHsMearOtWTg3fDRfmAVOaOanab m67yujuaW0esU+2GRuXRHiVJYsIUA8WZytD/nkzZ8O0njX0fvchxx4sAjZCluYTuALoX+F 79Ow0afYnQJqMZ5lpyo22uKByxMQoLClHH4/4CMrcF3yOQA/s5Ya0Va/JYPKOIzKlt6t+V BvdCR2+sl+P+PK+kPyHt4sdknsf8cmCaHri6qx4XUoXriT6qS+1ZUm4AJeevdQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645042491; a=rsa-sha256; cv=none; b=lkeb6nEQh2VqbX1JynplPXbvuSsHXyESN+z9mjDaWQnHCBgEhfItcCGTr25DjcfIUkEOFs f9DMAHbGG0cOuqljUHbjyccocnzfBiAkpa5qI4DLf7yF+xeXoq4+YBDHKJRAdmqAVjXNs2 O9YhBlOhm6L+W7SRPEvwwyFpt0X1e2KX223AEfMzeSbPA8I6Wi1y1pY3Ec8ao0z1Q01iRc Sa2twTduh3/3YfzNjBgol3/Gil/y/HXAki6i+yxu6KJ5pMcXByg3vuoqQZ6RxYblN+H6Gl yC8OLTCBMtwEC7LjHv71Yv7u2gYF4Qq0omaoHzdFUgKkidhV3C2EqecD3ddwUw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=beadling-co-uk.20210112.gappssmtp.com header.s=20210112 header.b=KR3iiFVa; 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: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=beadling-co-uk.20210112.gappssmtp.com header.s=20210112 header.b=KR3iiFVa; 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: 124413CDEC X-Spam-Score: -3.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: epvpHQs9bMzn --=-=-= Content-Type: text/plain Hi, At the moment there doesn't seem to be any way to request ANSI stdout/err from Guix if your output is not a tty. However when capturing Guix output for display inside a front-end for running jobs across many servers (eg Jenkins, Rundeck, etc) - these tools are often capable of rendering ANSI output captured from console tools like Guix. Other tools (eg py-test, flake8) often allow the user to explicitly force color output even when a tty is not detected. The attached patch is a trivial attempt at make such an option available in Guix too. I've done this in the least disruptive way possible, which is to introduce an new env var such that users of the NO_COLOR env var will get continuity of functionality. Cheers, Phil --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-allow-user-to-force-color-when-not-a-tty.patch >From 010be2b6d4b1ec865a686345116deb92570636e2 Mon Sep 17 00:00:00 2001 From: "Phil.Beadling" Date: Wed, 16 Feb 2022 17:40:32 +0000 Subject: [PATCH] allow user to force color when not a tty --- guix/colors.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/guix/colors.scm b/guix/colors.scm index 3031f54799..c57c139864 100644 --- a/guix/colors.scm +++ b/guix/colors.scm @@ -131,8 +131,9 @@ that subsequent output will not have any colors in effect." (define (color-output? port) "Return true if we should write colored output to PORT." - (and (not (getenv "NO_COLOR")) - (isatty?* port))) + (or (getenv "GUIX_COLOR_OUTPUT") + (and (not (getenv "NO_COLOR")) + (isatty?* port)))) (define (coloring-procedure color) "Return a procedure that applies COLOR to the given string." -- 2.25.1 --=-=-=--