From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#54136: 29.0.50; Eshell emits extra prompts when killing processes in some cases Date: Wed, 23 Feb 2022 21:11:41 -0800 Message-ID: <1bfc8b00-0062-70b6-6492-01cf3947e55b@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33144"; mail-complaints-to="usenet@ciao.gmane.io" To: 54136@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 24 06:12:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nN6Qh-0008QC-7O for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 06:12:39 +0100 Original-Received: from localhost ([::1]:57900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN6Qf-0001kq-Pr for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 00:12:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN6Q6-0001kR-84 for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 00:12:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53259) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN6Q5-0001JI-UN for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 00:12:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nN6Q5-0000PW-Qm for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 00:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 05:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54136 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16456795151564 (code B ref -1); Thu, 24 Feb 2022 05:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2022 05:11:55 +0000 Original-Received: from localhost ([127.0.0.1]:47156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN6Pz-0000PA-JY for submit@debbugs.gnu.org; Thu, 24 Feb 2022 00:11:55 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:48358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN6Py-0000P0-F5 for submit@debbugs.gnu.org; Thu, 24 Feb 2022 00:11:54 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN6Py-0001jz-3j for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 00:11:54 -0500 Original-Received: from [2607:f8b0:4864:20::435] (port=36849 helo=mail-pf1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN6Pu-0001IY-SD for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 00:11:53 -0500 Original-Received: by mail-pf1-x435.google.com with SMTP id z16so889399pfh.3 for ; Wed, 23 Feb 2022 21:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:subject:to:message-id:date:mime-version:content-language :content-transfer-encoding; bh=NdU8k40TCy9G/oanCj0cgSSOnOapAwR0R82w8IKbvKg=; b=Wr3r1tq91lpq/ECgBZxCmvspMqU4pfpWwVqXG+/eybTj8+bEZieagCFrxSeU0aXTw8 eeRhlnpNhcHtbfLqCVLcEoc9tjDlF3BI0CAp4z1RjdJcsY2xKR5EehY/bxseTndNkb8f 5V2VKMZl9CYW+bjiROQ0Tn1p39rdqCLx/8mKeiudz0fSFfhCX7iXduPYIjdr/QJtcGaK A/n9a5lK/OL1yr4uB8JwK7rSiK3kyr31IyapjCdIinPK2PTOOOWcBCO2Epk/XIVgNuyt /w2QNJfxLfHtxjp9sy7ioO5LKfMw/qwzbsDM+/xI2vXfTK43heJoqUs3wdmVJdURW/9U AvqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:message-id:date:mime-version :content-language:content-transfer-encoding; bh=NdU8k40TCy9G/oanCj0cgSSOnOapAwR0R82w8IKbvKg=; b=YXOSIuJSOQ68fXQ3TuKKObsUJb3919+74pchTgD9/2fE4geKDmedAnjn5tgx/KUMzi GRsGL0ICTqBZl61Ux8ZuepzsnoOD7D3zN4FloS4WiH5ho4kxjXFZhJgMcg39OzSXCTvB 9i2vCz57ZRODzt9gqfZt3rh1OMLvb9rcBEwDCimUwIE8tiIk1ispit5oowPnUSYvKy73 vPQ0GuUMZWO0RQn4Upp5J4l8z2ScaEXlSHL0NOXLkRdjooV6A0IrLvuUupYoxY8Q4lto 44hckDmx7UI2pPNj+ev3EumgempLT8beSnW3dprv8KWyWbwwcq76MCH6ktzQ5tv3c+EZ zBnA== X-Gm-Message-State: AOAM5328WceMu+/sKTiib3AX0eVaTzt2Ib+wUBHDH983NzCeVJ3qlRuB mBhShZYAxUvD/FgVyFVqb/9z08OGuws= X-Google-Smtp-Source: ABdhPJxK9hyqr93AyjeU9PRmxX6wgs7sAXGLvK1ECxfzwl9c1Ac54ECYAi63KUjKmsiRrqWzMyAObg== X-Received: by 2002:a63:465b:0:b0:374:642c:ab62 with SMTP id v27-20020a63465b000000b00374642cab62mr1015291pgk.187.1645679502611; Wed, 23 Feb 2022 21:11:42 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id 23-20020a17090a0d5700b001bc3c650e01sm7487595pju.1.2022.02.23.21.11.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 21:11:42 -0800 (PST) X-Mozilla-News-Host: news://news.gmane.org:119 Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::435 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:227556 Archived-At: (Patch forthcoming; I'm just getting a bug number first...) Sometimes, when killing processes in Eshell (especially in pipelines), Eshell will emit *two* prompts instead of one. Starting with "emacs -Q --eval '(eshell)'... Problem #1: Killing pipelines ----------------------------- ~ $ sh -c 'while true; do echo y; sleep 1; done' | sh -c 'while true; do read NAME; done' C-c C-c ; or C-c C-k The result is ("|" is the point): interrupted ~ $ ~ $ | What's happening here is one prompt is being emitted per process in the pipeline. It should only emit one prompt total. Problem #2: Killing the head of a pipeline ------------------------------------------ ~ $ sh -c 'while true; do sleep 1; done' | sh -c 'while read NAME; do echo =${NAME}=; done' M-: (kill-process (eshell-head-process)) RET The result is: ~ $ =killed= | In this case, Eshell writes the head process's exit status message to its stdout handle (i.e. to the tail process's stdin). It should either write directly to the terminal, or not write at all. I went with the latter, since the former would mean that we write "interrupted" N times in problem #1 above. Problem #3: Killing a background process ---------------------------------------- ~ $ sh -c 'while true; do sleep 1; done' & This outputs, as expected: [sh] 12345 ~ $ Now call `(kill-process (caar eshell-process-list))'. The result is: ~ $ killed ~ $ | Here, Eshell writes the exit status to the terminal, but does so in an awkward spot, and then emits a new prompt. I think it should just avoid printing anything here. Information about the killed process is also shown in the minibuffer, so the user already has a place (and a better one at that!) to see what happened.