From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EATRLlKkFWQnNwAASxT56A (envelope-from ) for ; Sat, 18 Mar 2023 12:45:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mBi8LlKkFWRISAEA9RJhRA (envelope-from ) for ; Sat, 18 Mar 2023 12:45:22 +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 9A9FA17850 for ; Sat, 18 Mar 2023 12:45:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdUzh-0003z1-Ca; Sat, 18 Mar 2023 07:45:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdUze-0003yf-6u for guix-patches@gnu.org; Sat, 18 Mar 2023 07:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pdUzd-0006dc-Tw for guix-patches@gnu.org; Sat, 18 Mar 2023 07:45:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdUzd-0006i2-Q1 for guix-patches@gnu.org; Sat, 18 Mar 2023 07:45:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62056] [PATCH] guix: Only issue erase-current-line sequence for ttys. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Mar 2023 11:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62056 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 62056@debbugs.gnu.org Received: via spool by 62056-submit@debbugs.gnu.org id=B62056.167913987925714 (code B ref 62056); Sat, 18 Mar 2023 11:45:01 +0000 Received: (at 62056) by debbugs.gnu.org; 18 Mar 2023 11:44:39 +0000 Received: from localhost ([127.0.0.1]:46453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdUzH-0006gg-1m for submit@debbugs.gnu.org; Sat, 18 Mar 2023 07:44:39 -0400 Received: from smtpm4.myservices.hosting ([185.26.105.235]:55646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdUzF-0006gX-Bl for 62056@debbugs.gnu.org; Sat, 18 Mar 2023 07:44:38 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm4.myservices.hosting (Postfix) with ESMTP id EE33820BF0; Sat, 18 Mar 2023 12:44:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 795788009A; Sat, 18 Mar 2023 12:27:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3-SRC-LaPyqj; Sat, 18 Mar 2023 12:27:20 +0100 (CET) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id ABFF580098; Sat, 18 Mar 2023 12:27:20 +0100 (CET) Message-ID: <99afbc21-920c-1867-e368-d541ae524283@makinata.eu> Date: Sat, 18 Mar 2023 11:27:12 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US References: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@makinata.eu> <874jqkbd0h.fsf@gnu.org> From: Bruno Victal In-Reply-To: <874jqkbd0h.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679139922; a=rsa-sha256; cv=none; b=n7uL1wEbKf66M8z13EIlXk5gypYLdJIYmMumxNX5Xod+TVuHrhrJuVP3ZugKxc2YYTAGm+ G9i1MejHyE0+CEpreIXh60VcB9kLhqOsMZYmdZ2bm5ESEZToLFsk+/Xb2hp9EVYC5qAn6t 8TwGETmXvbOVIfQazw1sfvhPkMC835s8F4gfvmsrXIKgn2KgB3idEb82lzjT/LR3//E43a Q8gMrcVG8QHH2YgYhRCXlvjley6dIbgWAFB0LLItYzgvLtP0pUW7uFRcsEiKmZ+Qh+MfcU DD7TPI8TQD/9Al5ipJGE/s2Z7t6uDhCyeUFkrqPEe2XgVCVQwkX7PKVz7bcj0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679139922; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=U7xJiLbJegT6sgEqNzvqhgtzb3x+Q6YnkTvLNWtYf4E=; b=ElcaeDyZ8oI1dQI4SKan1DdfRN/L8vfsPbOO2qoG1hzGwihqXD3tM1FP93iRi7nThgAefd PcCtPxRSPbXNrOn1hXiSGqjkkh84EX7pv8hT9RgebNGjFvZmG9hz2+LkjpcAw0I5H6aMnA zZx2lkuVulFqgV9YXCnE6Iqhb89ygKXl77JiKSqsJpggMgUEpLFg4Mofokm0PvnX9UsqOT zo3vby8XTnCx3qrz3zgf94zhYorext4pGPLDF/2g5JaVvVosKIF5qzR/xrLvga97Jo0pPz mrs1RHpg8SIMhrZDPIF+ndhBmxBoP4Pr1+TCNxOPmsW9ZMxNDny/vUMVUqsT4Q== X-Migadu-Spam-Score: -3.25 X-Spam-Score: -3.25 X-Migadu-Queue-Id: 9A9FA17850 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=none X-TUID: hy0aL0ZgzwyX Hi Ludo’, On 2023-03-16 21:30, Ludovic Courtès wrote: > Bruno Victal skribis: >> (define (erase-current-line port) >> - "Write an ANSI erase-current-line sequence to PORT to erase the whole line and >> -move the cursor to the beginning of the line." >> - (display "\r\x1b[K" port)) >> + "When @var{port} is interactive, write an ANSI erase-current-line sequence >> +to erase the whole line and move the cursor to the beginning of the line, >> +otherwise write a newline." >> + (if (isatty? port) >> + (display "\r\x1b[K" port) >> + (newline port))) > > We should avoid calling ‘isatty?’ every time, it’s too costly, which is > why there’s also ‘isatty?*’ somewhere that memoizes things. > > However, it seems up to the caller to check that before calling > ‘erase-current-line’. That seems to be the case within progress.scm and > in (guix status). guix/status.scm:471 defines a erase-current-line* which calls isatty?*. Does this mean that erase-current-line has to be “wrapped” every time we want it to have tty awareness? If that's not the case, perhaps we could change the signature of erase-current-line to: (define* (erase-current-line port #:optional tty?) > Could you see which use of ‘erase-current-line’ is causing problems? guix/scripts/substitute.scm:318 Cheers, Bruno