Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Pipes and @CONSOLEB

May
13,035
174
V24 (v23 is similar) and Win10/64. See below. FINDSTR works in a pipe. After switching to a new console screen buffer and returning, FINDSTR no longer works in a pipe. FINDSTR is not special; the same thing (namely nothing) happens with various versions of GREP and anything else used in a pipe.. On Win7/32, some (not all) programs used in the pipe cause conhost.exe to crash with a message (or just disappear).

Code:
v:\> echo foo | findstr foo
foo

v:\> type buffertest.btm
set oldbuffer=%@consoleb[-1]
set newbuffer=%@consoleb[0]
echo %@consoleb[%oldbuffer]
echo %@fileclose[%newbuffer]

v:\> buffertest.btm
19
0

v:\> echo foo | findstr foo

v:\>
 
I suspect the new console is not inheritable (bInheritFlag in the security attributes is not set.)
 
I suspect the new console is not inheritable (bInheritFlag in the security attributes is not set.)
I'm returning to the original bufer before doing anything. For the record, pipes don't work in the new buffer either. And I am not using TCMD.
 
Try it with build 21.
It seems to be fixed.

That explains a few years of the occasional unexplained failing of pipes. My plugins use an alternative console screen buffer (via @CONSOLEB) to display F1 and Ctrl-F1 help. I never before made the connection between using that mechanism and the subsequent failing of pipes.
 
Back
Top
[FOX] Ultimate Translator
Translate