bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54062: 29.0.50; [PATCH] Eshell should inform processes when a pipe i


From: Jim Porter
Subject: bug#54062: 29.0.50; [PATCH] Eshell should inform processes when a pipe is broken
Date: Fri, 18 Feb 2022 20:20:10 -0800

Consider the following shell command:

  yes | sh -c 'read NAME'

Ordinarily, you'd expect that `sh' reads a single "y", exits, and then the next time `yes' tries to write, it finds that the pipe was broken. However, that's not what happens in Eshell. Running the above and then calling `M-x list-processes' will show that `yes' is still running.

Attached is a patch (with a test) to fix this by telling Eshell to signal SIGPIPE at the appropriate time. I've also attached a couple small patches to clean up a few tiny issues in Eshell; if it would be better to split those out into a different bug, just let me know. I thought it might be simpler to attach them here rather than one bug for each.

(Note: for the test to pass, you might need to remove the .elc files before running the tests. Since the patch updates test/lisp/eshell/eshell-tests-helpers.el and there's not an easy way to force that to recompile before running the actual tests, it can fail in some cases.)

As an aside: of course, this is a somewhat contrived example. The real reason I care about this is to support Lisp functions in Eshell pipelines, so that you can run something like `git log | less', where `less' is a Lisp function that opens a View mode buffer. When closing that buffer, it would be nice to kill the `git log' process, since it can go on for quite a while in a big repository. My patch series for that feature is getting pretty unwieldy though (14 patches and counting), so I peeled this off to merge separately.

Attachment: 0001-lisp-eshell-esh-io.el-grep-null-device-Remove-unused.patch
Description: Text document

Attachment: 0002-Improve-docstrings-for-eshell-exec-lisp-and-function.patch
Description: Text document

Attachment: 0003-Ensure-eshell-output-object-always-returns-nil-for-c.patch
Description: Text document

Attachment: 0004-Send-SIGPIPE-to-external-Eshell-processes-if-their-o.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]