"cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang

Takashi Yano takashi.yano@nifty.ne.jp
Wed Jun 15 04:42:44 GMT 2022


On Wed, 15 Jun 2022 10:04:07 +0900
Takashi Yano wrote:
> On Tue, 14 Jun 2022 21:56:39 +0000
> 5990 wrote:
> > I ran all commands on cmd from within Windows Terminal. Note that running cmd.exe directly, and running cmd from the Windows Terminal is not the same. cmd.exe does not support ANSI codes.
> 
> My question was:
> What shell (command user interface) did you run in Windows Terminal?
> By default Windows Terminal runs 'Windows PowerShell', however, you
> can also run 'Command Prompt' (cmd.exe) in Windows Terminal. You also
> can run cygwin bash if you add configuration. What does tab on left
> upper of the window of Windows Terminal say?
> 
> > Also, what do you mean you can't reproduce the issue? Was it because of insufficient information, or because the commands worked perfectly on your system?
> 
> I meant 'cat empty.txt | go run color.go' outputs cyan 'golang-test'
> text.
> 
> > I noticed you didn't include python information in your environment. You can install the missing lolpython dependency from PiPy by running `pip install lolpython`
> 
> Which python implememtation do you use? I guess you do not use cygwin
> python. Microsoft store version? Or did you download it from
> https://www.python.org/downloads/ ?
> 
> I installed Microsoft store version of python (3.10.5) and run
> 'cat empty.txt | python color.py' from PowerShell in Windows Termianl,
> then it outputs gradate-colored 'python-test' text.

It has been confirmed that the patch:
https://cygwin.com/pipermail/cygwin-patches/2022q2/011935.html
fixed the issue.

Thanks.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin mailing list