unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54136: 29.0.50; Eshell emits extra prompts when killing processes in some cases
@ 2022-02-24  5:11 Jim Porter
  2022-02-24  5:16 ` Jim Porter
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Porter @ 2022-02-24  5:11 UTC (permalink / raw)
  To: 54136

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-25 18:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-24  5:11 bug#54136: 29.0.50; Eshell emits extra prompts when killing processes in some cases Jim Porter
2022-02-24  5:16 ` 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

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