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

From: Paul Eggert <[email-masked]>
Date: Sun, 27 Jul 2025 08:06:10 -0700

On 2025-07-26 21:30, 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.

EPIPE typically means exit, yes, as the process reports the error and 
often has nothing better to do than to exit. However, it doesn't always 
mean exit. For example, an interactive Emacs does not exit with it gets 
EPIPE, as can be demonstrated with this shell command on GNU/Linux:

strace -o /tmp/tr emacs -Q -eval \
   "(princ (make-string 10000 ?a) 'external-debugging-output)" 2>&1|:

and then type C-x C-c to exit Emacs.

In this case Emacs painstakingly outputs 10000 'a' bytes, one at a time, 
and ignores each of the 10000 EPIPE errors that it gets.

Not sure I know what you mean by "doing what a Posix shell does". Are 
you talking about commands that a shell implements directly, like the 
shell 'echo' command typically is? If so, those commands are supposed to 
do what their standalone counterpart executables do, which typically 
means they die due to getting a SIGPIPE signal.