Subject: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell

From: Jim Porter <[email-masked]>
Date: Sun, 27 Jul 2025 09:53:47 -0700

On 7/26/2025 9:30 PM, Eli Zaretskii wrote:
> We should try doing what a Posix shell does in that case.  A program
> that gets EPIPE generally exits with a failure status (right?),
> anything that happens after that is done by the shell itself.

Agreed. Eshell already does its best at the part you mention: in the 
pipeline "A | B", if A writes to B and gets an EPIPE error, Eshell sends 
a SIGPIPE to process A. (That's not *exactly* what happens in POSIX 
shells, but because of the additional indirection Eshell has between 
processes in a pipeline, it's as close as I can get without major surgery.)

The remainder is just to make sure that we follow POSIX shell behavior 
as closely as we can for process B as well.

As for the rest of the discussion here, my goal isn't exactly to make 
Emacs behave like a POSIX shell (which is apples-to-oranges, as Emacs 
isn't a shell), but to make *Eshell* behave like a POSIX shell. That 
requires some changes to process.c, but I think those changes will be 
positive for Emacs in general; the result will be that Emacs responds 
more carefully to EPIPE.

(Of course, if there are any changes that would help Eshell but *hurt* 
Emacs's process support in other scenarios, I won't make those. But I'm 
pretty sure we won't run into this problem.)