Recently, on all of my Cygwin-running Windows computers (all Windows 11 25H2, 
64-bit, all fully patched per Microsoft, all running recent-or-current Cygwin 
installer downloads/updates), if I run (in a Windows CMD.EXE window), e.g.

C:\>ls.exe  |  less.exe

IFF the output of the first Cywgin command (e.g. above "ls.exe") would require 
less to perform paging, then on exiting (that is, the output of the command 
pipeline leading into the |less  would be more than one page), then typing 'q' 
to exit less does nothing. The less process hangs, and must be killed with e.g. 
Windows Task Manager.

The 'q' that I'd pressed on the keyboard which normally would have been 
consumed by less and caused an exit of less and of any remaining commands in 
the pipeline still executing, actually appears at the next CMD prompt, e.g. the 
following appears after the last line of text that less had displayed, after I 
kill the less.exe process:

C:\ >q

This does NOT occur if I run it in the Cygwin64 Terminal app, and it also does 
not occur in a PowerShell window.
Perhaps most tellingly, it also does not occur in a Windows Legacy Console 
(C:\Windows\System32\conhost.EXE) window.

Lots (and lots) of Googling suggests that this is due to some recent change in 
Windows pseudoterminals which Cygwin unfortunately has to catch up with, to 
avoid Microsoft's apparently breaking change .. breaking Cygwin command 
pipelining. Something that came up in a couple of discussion forums, which may 
or may not really be what's going on, is that somehow the pipeline doesn't 
actually die/ get killed if it hasn't naturally ended by finishing generating 
whatever output it would have generated, before less tries to exit.  I have my 
doubts about that, because ls -1 | less (hit 'G' to go to the bottom, wait, 
wait, wait, hit 'q') should have long since allowed the source pipeline to 
finish its output and die off naturally. Also, in Task Manager, when this 
problem occurs, I always find less.exe running, but I do not see the e.g. 
ls.exe command still running.

So it really does seem to be some new Microsoft Terminal mode incompatibility 
with how less tries to control the terminal.
-Jay

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to