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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 17 Aug 2025 10:57:04 +0300

> Date: Sat, 16 Aug 2025 23:33:49 -0700
> Cc: [email-masked], [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> > P.S. I'd like to see what this does on Windows, where there's neither
> > SIGPIPE nor EPIPE, but that's a separate funeral.
> 
> For what it's worth, Gnulib says the following:
> 
> /* On native Windows platforms, SIGPIPE does not exist.  When write() is
>     called on a pipe with no readers, WriteFile() fails with error
>     GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
>     error EINVAL.  */
> 
> Gnulib's 'write' (well really, 'rpl_write') checks for ERROR_NO_DATA and 
> raises SIGPIPE for us, so hopefully we're ok here?

We don't use Gnulib's replacement for 'write', so if anything is
needed in this area, we'll need to do it in w32.c:sys_write (which
also supports network and serial connections, so it would be
interesting what socket error is returned when the other side closes
the socket.

There's also ERROR_BROKEN_PIPE, which happens when _reading_ from a
pipe whose other end was closed.  is that also EPIPE on Posix systems?