Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: W02jobs.ztst: huge delay if output is piped (macOS)



> 2026/07/04 8:31、Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>のメール:
> 
> On Fri, Jul 3, 2026 at 10:44 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> 
>> % make TESTNUM=W02 check | cat
>> ... test output ...
>> ***********************************************
>> 1 successful test script, 0 failures, 0 skipped
>> ***********************************************
>> make[1]: Leaving directory '/.../zsh/Test'
>> [this is where the 100 second delay happens]
> 
> I tried
> % make TESTNUM=W02 check | strace cat
> 
> on Ubuntu 24.04.4 and I don't see the delay.  

On my Linux, adding '| cat' causes a few seconds delay.

> Nor do I see any
> reference to fd=12 in the "cat" child.

cat has fd=0 for reading from the pipe, and sleep has
fd=12 for writing. Please try using lsof from another
terminal window while running the test.

>> I agree that there doesn't seem to be a
>> reason that this sleep should be so long, though
> 
> The test needs sleep to survive long enough for the shell driving zpty
> to read back the PID, send a "kill -STOP", and then attempt "fg %-"
> and read the output of "jobs".  It probably doesn't need "sleep 100"
> but a single-digit sleep might not be long enough.

I tested on a Linux (virtual machine on Mac):
  sleep 0.00000001 	Ok
  sleep 0.000000001	Fail
so I guess 'sleep 3' would be enough.



Messages sorted by: Reverse Date, Date, Thread, Author