Subject: bug#59103: 29.0.50; esh-var-tests intermittently fails on macOS 12.6.1

From: Jim Porter <[email-masked]>
Date: Mon, 7 Nov 2022 21:39:57 -0800

On 11/7/2022 3:09 AM, Stefan Kangas wrote:
> Intermittently failing test on macOS 12.6.1, see below output from
> "make -j5 check":
> 
[snip]
> They do not fail every time: sometimes neither fails, sometimes one
> does and sometimes the other.  Only once did both fail at the same
> time, after several runs of "make check".

Both of these failures look like the ${subcommand} didn't see any output 
by the time Eshell expanded it into the top-level command. My guess is 
that something is going awry in 'eshell-sentinel'. I haven't been able 
to reproduce this locally (on a GNU/Linux system), but since it seems 
you *can* reproduce it, you could try the following:

1. Check if 'eshell-output-object' ever gets called from within 
'eshell-sentinel' or from the 'finish-io' timer defined there

2. If so, try moving the 'eshell-kill-process-function' call at the end 
of 'eshell-sentinel' (and maybe the 'when-let' block immediately above 
it) inside 'finish-io'

My reasoning here is that I think 'eshell-kill-process-function' is what 
will signal to the rest of Eshell that the process is done, but if the 
process still has output pending (i.e. 'finish-io' gets called from a 
timer to do its thing), then that pending output would get lost.

Hopefully that at least points you in the right direction...