Win10's ANSI doesn't like 2>NUL

May 20, 2008
12,173
133
Syracuse, NY, USA
1545620957855.png
 
May 20, 2008
12,173
133
Syracuse, NY, USA
This persists in build 30. In a half-hour or so I'll find out if the latest insider preview of Windows 10 helps.
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
TCC is not involved. The API to turn ANSI on & off is SetConsoleMode with the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag. After doing the redirection, Windows is turning off that flag. TCC notices this when it executes the next command, and turns it back on.

You need to contact Microsoft about why they're doing that.
 
May 20, 2008
12,173
133
Syracuse, NY, USA
TCC is not involved. The API to turn ANSI on & off is SetConsoleMode with the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag. After doing the redirection, Windows is turning off that flag. TCC notices this when it executes the next command, and turns it back on.

You need to contact Microsoft about why they're doing that.
CMD doesn't exhibit this problem. Are you going to work around it?
 
May 20, 2008
12,173
133
Syracuse, NY, USA
CMD uses different APIs for redirection. I could emulate the CMD behavior, but it would result in losing 99% of the TCC line editing features.
Earlier you said "TCC notices this when it executes the next command, and turns it back on". I don't know how it works but ... can't TCC notice it earlier, say, before issuing the next prompt (without ill effect)?
 
May 20, 2008
12,173
133
Syracuse, NY, USA
If it's at all costly, never mind. I probably redirect stderr perhaps once in tens of thousand commands. And that would be almost 100% in BTMs where it would have to be the last line to cause a problem. FWIW, "alias post_exec noop" gets rid of it but I canned that idea for the reason just mentioned.
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
I can't move it earlier because that would cause it to fail in batch files. I can add it earlier *as well* as the later check, but there'll be a performance hit. And Windows will still be turning off ANSI *during* the command. And there's no guarantee that Windows won't be doing the same thing elsewhere.

So - I can add a hack to hide it in some cases. But only Microsoft can actually fix it.
 

Similar threads