GNU bug report logs - #54136
29.0.50; Eshell emits extra prompts when killing processes in some cases

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Thu, 24 Feb 2022 05:12:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Eshell emits extra prompts when killing processes in some
 cases
Date: Wed, 23 Feb 2022 21:11:41 -0800
(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.




This bug report was last modified 3 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.