unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: 54136@debbugs.gnu.org
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	[thread overview]
Message-ID: <1bfc8b00-0062-70b6-6492-01cf3947e55b@gmail.com> (raw)

(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.





             reply	other threads:[~2022-02-24  5:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  5:11 Jim Porter [this message]
2022-02-24  5:16 ` bug#54136: 29.0.50; Eshell emits extra prompts when killing processes in some cases Jim Porter
2022-02-24  9:35   ` Lars Ingebrigtsen
2022-02-24 11:03     ` Eli Zaretskii
2022-02-24 18:55       ` Jim Porter
2022-02-24 20:03         ` Eli Zaretskii
2022-02-24 20:07           ` Lars Ingebrigtsen
2022-02-25  1:04             ` Jim Porter
2022-02-25  2:18               ` Lars Ingebrigtsen
2022-02-25  7:09               ` Eli Zaretskii
2022-02-25 18:31                 ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bfc8b00-0062-70b6-6492-01cf3947e55b@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=54136@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).