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 ms9.migadu.com with LMTPS id 6MXBEoP3PmT/AAEASxT56A (envelope-from ) for ; Tue, 18 Apr 2023 22:03:15 +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 AEeXEoP3PmTQYwEAauVa8A (envelope-from ) for ; Tue, 18 Apr 2023 22:03:15 +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 E982F32ADE for ; Tue, 18 Apr 2023 22:03:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1porXg-0007Aa-RO; Tue, 18 Apr 2023 16:03:08 -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 1porXd-0007A8-Q2 for guix-patches@gnu.org; Tue, 18 Apr 2023 16:03:06 -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 1porXb-0002AV-Gy for guix-patches@gnu.org; Tue, 18 Apr 2023 16:03:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1porXa-0005sa-3Q for guix-patches@gnu.org; Tue, 18 Apr 2023 16:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62056] [PATCH] guix: Only issue erase-current-line sequence for ttys. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 18 Apr 2023 20:03:02 +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: Bruno Victal Cc: 62056@debbugs.gnu.org Received: via spool by 62056-submit@debbugs.gnu.org id=B62056.168184813222540 (code B ref 62056); Tue, 18 Apr 2023 20:03:02 +0000 Received: (at 62056) by debbugs.gnu.org; 18 Apr 2023 20:02:12 +0000 Received: from localhost ([127.0.0.1]:60432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1porWm-0005rT-Ga for submit@debbugs.gnu.org; Tue, 18 Apr 2023 16:02:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1porWl-0005rG-2z for 62056@debbugs.gnu.org; Tue, 18 Apr 2023 16:02:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1porWe-00026c-MW; Tue, 18 Apr 2023 16:02:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=1X/EAdgNe70Wd8WqOhqGkm2FNJhcEHqTimqJFZvjCdM=; b=Pk7YO1iLFYgOURO+B4gL b6B+hcA+2Zf8jfl3OskFHoezCIWS0KTRUylYEzKlwkJo/YbR+8kyxvgOgpROm6gdK3MiqKFCt1Hie 0yQeI6ucleK/NH5Hjmp37LwpY22CocB4VryqONytt3vW+QWefXA4Hla0W/uo1yyNq6lBiG0Op33Mc XVOuE3xQW/br0WMrem3EDs79jlaF+NOHYKmzFLE3XOu9KrLgDD1rf3v4m8pC/K7z3Bd5NdhZV+Es/ IJEYZg8nV+kklUZZKzKZx1SF7WT8qUAcWthJ3ZGIFoA1xNsh9GkG9TzUvp0FEJd/sDd65Bim9oNtQ oRRDkLiJ1duvjg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1porWd-0008Ps-Ir; Tue, 18 Apr 2023 16:02:04 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <6a78ee837fe579d6b1beaeda54beddba3c05fd2e.1678290800.git.mirai@makinata.eu> <874jqkbd0h.fsf@gnu.org> <99afbc21-920c-1867-e368-d541ae524283@makinata.eu> Date: Tue, 18 Apr 2023 22:02:00 +0200 In-Reply-To: <99afbc21-920c-1867-e368-d541ae524283@makinata.eu> (Bruno Victal's message of "Sat, 18 Mar 2023 11:27:12 +0000") Message-ID: <877cu9hscn.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Seal: i=1; s=key1; d=yhetil.org; t=1681848195; a=rsa-sha256; cv=none; b=oWReA31hFXWrpbaObSveb/2j24ciWaG7sTxCGn3SXCEU7rk2KN5llD/orMRDK3ajv6Zlvs Q7zoQ8IeO8PQZCCJwz6DIpJexv8sUsiWtUzsNjBt5QxDFFB1suFif/Q68MMrugj4IZp2J1 yEufvp14bx99ZKQkas/tTt6rF39/uyNtvGoC5FtTwvjUVXcdDBOet4/bVNoYBvTgXIatEy 5E4xyq8jG45mk5ibhoK0CdO8AMKuZtXIEkJ5YA08C8GDej+bm/rN7Ul2DH/uwKrvhMB0wj /7rb74S9fJjmy2SFR1RsJupe86W0TnWEi8sDt6wVfIoBf/OrECMtrx2eNCXYqw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Pk7YO1iL; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681848195; 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:dkim-signature; bh=1X/EAdgNe70Wd8WqOhqGkm2FNJhcEHqTimqJFZvjCdM=; b=eocsRvOZuHVeYPcFENNHHrlDrIMMcpu6kOjttpTt9l6AQWzPcX4x52KBFnc1Igl9kb2AlF Bjk69ezpVV18Fddp5CqpQwdOXDJRZw/paSfI+WauFwXsOqpUdaPLu4y+vJtQF6udVA4NYk PLYyLeZy7XnyMbnqKoQNi6pNqDwmVB1foQ0hmP8Qx+2k9PfJ0Gw0XR0imI4M5zwTlo+/n5 p9ZAs5miCS7MATp5EQdoBbPD9LVnl5zrd3fM0ddRUt13dCgM5UMR4pKKI5MLOxIyfAO2cg nNmJXKIn7FXynKX3XvRrqowryQuhlbVdpnRVYUaOhBN92wn2iVNE4AHYDyrHYg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -2.61 X-Spam-Score: -2.61 X-Migadu-Queue-Id: E982F32ADE Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Pk7YO1iL; dmarc=pass (policy=none) header.from=gnu.org; 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-TUID: R03TLOnTt9qj Hi Bruno, Bruno Victal skribis: > On 2023-03-16 21:30, Ludovic Court=C3=A8s wrote: >> Bruno Victal skribis: >>> (define (erase-current-line port) >>> - "Write an ANSI erase-current-line sequence to PORT to erase the whol= e 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 se= quence >>> +to erase the whole line and move the cursor to the beginning of the li= ne, >>> +otherwise write a newline." >>> + (if (isatty? port) >>> + (display "\r\x1b[K" port) >>> + (newline port))) >>=20 >> We should avoid calling =E2=80=98isatty?=E2=80=99 every time, it=E2=80= =99s too costly, which is >> why there=E2=80=99s also =E2=80=98isatty?*=E2=80=99 somewhere that memoi= zes things. >>=20 >> However, it seems up to the caller to check that before calling >> =E2=80=98erase-current-line=E2=80=99. 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 =E2=80=9Cwrapped=E2=80= =9D every time > we want it to have tty awareness? =E2=80=98erase-current-line=E2=80=99 is low-level and often the caller has = already done an =E2=80=98isatty?=E2=80=99 check before calling it (for instance in progr= ess bars). I think that=E2=80=99s the reason it doesn=E2=80=99t include that check. > If that's not the case, perhaps we could change the signature of erase-cu= rrent-line to: > (define* (erase-current-line port #:optional tty?) I don=E2=80=99t think so. >> Could you see which use of =E2=80=98erase-current-line=E2=80=99 is causi= ng problems? > > guix/scripts/substitute.scm:318 In this particular case, how about returning a different depending on =E2=80=98isatty?=E2=80=99? Thanks, Ludo=E2=80=99.