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

From: Daniel Mendler <[email-masked]>
Date: Wed, 23 Jul 2025 18:36:56 +0200

Jim Porter <[email-masked]> writes:

> On 7/23/2025 2:55 AM, Daniel Mendler via Bug reports for GNU Emacs, the Swiss
> army knife of text editors wrote:
>> sometimes when executing commands in Eshell with pipes the output seems
>> to get lost, for example:
> [snip]
>> Can someone confirm these problems? Thanks!
>
> I'm not able to reproduce this locally, but if you first run "eshell-debug
> process", that will log a bunch of process-related information to the buffer
> "*eshell last cmd*". That would probably have some details that at least show
> where the I/O went missing.

Thanks. I tried your suggestion. What stood out is that in the failed
runs, the output from the git process is received, and passed on to the
head process, but no output is received from head. It seems that the
head filter function is never called? This would hint at a lower-level
problem. See the logs of the runs below.

The problem occurs in particular for this command:

git log --color=always --decorate=yes | head -n 1

While it does not happen (or not so often) for this:

git log --color=always --decorate=yes | cat | head -n 1

Did you try the loop with the echo and the command? Do you have any
further suggestions on how to debug this? Maybe it has something to do
with my specific build.

Daniel

### Good run
[process] started external process ‘head’
[process] started external process ‘git’
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] received output from process ‘head’ <===== received output
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] sentinel for external process ‘git’: "broken pipe
[process] i/o busy for process ‘git’
[process] sentinel for external process ‘git-stderr’: "finished
[process] finished external process ‘git-stderr’
[process] sentinel for external process ‘head’: "finished <===== finished
[process] finished external process ‘head’
[process] finished external process ‘git’

### Bad run
[process] started external process ‘head’
[process] started external process ‘git’
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] received output from process ‘git’
[process] forwarding output from process ‘git’
[process] sentinel for external process ‘head’: "finished
[process] finished external process ‘head’ <===== finished without output
[process] sentinel for external process ‘git’: "broken pipe
[process] i/o busy for process ‘git’
[process] sentinel for external process ‘git-stderr’: "finished
[process] finished external process ‘git-stderr’
[process] finished external process ‘git’