public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
@ 2022-06-14  8:01 5990
  2022-06-14 10:47 ` Takashi Yano
  0 siblings, 1 reply; 6+ messages in thread
From: 5990 @ 2022-06-14  8:01 UTC (permalink / raw)
  To: cygwin

## Bug:
Piping the standard output of cat into the standard input of golang or python, makes the Windows Terminal render ANSI codes as arrows.

For example:
`\033[36m` turns into `←[36m` (or in base64'd UNICODE: `4oaQWzM2bQ==`)

## Environment:
- cat v8.26
- Windows Terminal v1.12.10982.0
- golang version go1.17.2 windows/amd64
- python v3.7.7

colors.go
```
package main

import "fmt"

const colorReset = "\033[0m"
const colorCyan = "\033[36m"

func main(){
  fmt.Print(string(colorCyan) + "golang-test" + string(colorReset) + "\n")
}
```


color.py
```
from lolpython import lol_py

lol_py("python-test")
```


domains.txt is an empty file (from my testing, the contents of domains.txt do not affect this bug)

## What works:
The following commands will successfuly output in cyan color
`go run color.go`
`go build color.go && color.exe`
`go build color.go && cat domains.txt | color.exe`
`go build color.go && echo a | color.exe`
`go build color.go && type domains.txt | color.exe`
`py -3.7 color.py`

## What triggers the bug:
`cat domains.txt | go run color.go`
OUTPUT: `←[36mgolang-test←[0m`

`cat domains.txt | py -3.7 color.py`
OUTPUT: `←[38;2;128;237;18mp←[0m←[38;2;139;231;12my←[0m←[38;2;150;225;8mt←[0m←[38;2;161;217;5mh←[0m←[38;2;172;209;2mo←[0m←[38;2;182;200;1mn←[0m←[38;2;192;190;1m-←[0m←[38;2;201;180;1mt←[0m←[38;2;210;170;3me←[0m←[38;2;218;159;5ms←[0m←[38;2;226;148;9mt←[0m`

Strangely enough, golang compiled executables work perfectly, but piping `cat domains.txt | go run color.go` does not work.
The workaround I had to go with is to use Windows's built-in `type` command instead of `cat`. This was a tricky bug to track-down so I hope this report helps hahah

- ItsIgnacioPortal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
  2022-06-14  8:01 "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang 5990
@ 2022-06-14 10:47 ` Takashi Yano
  2022-06-14 21:53   ` 5990
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Yano @ 2022-06-14 10:47 UTC (permalink / raw)
  To: cygwin

On Tue, 14 Jun 2022 08:01:45 +0000
5990 via Cygwin wrote:
> ## Bug:
> Piping the standard output of cat into the standard input of golang or python, makes the Windows Terminal render ANSI codes as arrows.
> 
> For example:
> `\033[36m` turns into `←[36m` (or in base64'd UNICODE: `4oaQWzM2bQ==`)
> 
> ## Environment:
> - cat v8.26
> - Windows Terminal v1.12.10982.0
> - golang version go1.17.2 windows/amd64
> - python v3.7.7
> 
> colors.go
> ```
> package main
> 
> import "fmt"
> 
> const colorReset = "\033[0m"
> const colorCyan = "\033[36m"
> 
> func main(){
>   fmt.Print(string(colorCyan) + "golang-test" + string(colorReset) + "\n")
> }
> ```
> 
> 
> color.py
> ```
> from lolpython import lol_py
> 
> lol_py("python-test")
> ```
> 
> 
> domains.txt is an empty file (from my testing, the contents of domains.txt do not affect this bug)
> 
> ## What works:
> The following commands will successfuly output in cyan color
> `go run color.go`
> `go build color.go && color.exe`
> `go build color.go && cat domains.txt | color.exe`
> `go build color.go && echo a | color.exe`
> `go build color.go && type domains.txt | color.exe`
> `py -3.7 color.py`
> 
> ## What triggers the bug:
> `cat domains.txt | go run color.go`
> OUTPUT: `←[36mgolang-test←[0m`
> 
> `cat domains.txt | py -3.7 color.py`
> OUTPUT: `←[38;2;128;237;18mp←[0m←[38;2;139;231;12my←[0m←[38;2;150;225;8mt←[0m←[38;2;161;217;5mh←[0m←[38;2;172;209;2mo←[0m←[38;2;182;200;1mn←[0m←[38;2;192;190;1m-←[0m←[38;2;201;180;1mt←[0m←[38;2;210;170;3me←[0m←[38;2;218;159;5ms←[0m←[38;2;226;148;9mt←[0m`
> 
> Strangely enough, golang compiled executables work perfectly, but piping `cat domains.txt | go run color.go` does not work.
> The workaround I had to go with is to use Windows's built-in `type` command instead of `cat`. This was a tricky bug to track-down so I hope this report helps hahah

I cannot reproduce your problem.

My environment is:
cygwin 3.3.5
cat 8.32
Windows Terminal 1.13.11431.0
go version go1.18.3 windows/amd64

What shell did you use? cygwin bash? cmd.exe? powershell?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
  2022-06-14 10:47 ` Takashi Yano
@ 2022-06-14 21:53   ` 5990
  2022-06-14 21:56     ` 5990
  0 siblings, 1 reply; 6+ messages in thread
From: 5990 @ 2022-06-14 21:53 UTC (permalink / raw)
  To: takashi.yano, cygwin

[-- Attachment #1: Type: text/plain, Size: 2838 bytes --]

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.

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?

By the way, I've attached my cygcheck.out; I forgot to attach it at first. I've redacted my username and computer name.

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`
-------- Original Message --------
On Jun. 14, 2022, 7:47 a.m., Takashi Yano < takashi.yano@nifty.ne.jp> wrote:

> On Tue, 14 Jun 2022 08:01:45 +0000 5990 via Cygwin wrote: > ## Bug: > Piping the standard output of cat into the standard input of golang or python, makes the Windows Terminal render ANSI codes as arrows. > > For example: > `\033[36m` turns into `←[36m` (or in base64'd UNICODE: `4oaQWzM2bQ==`) > > ## Environment: > - cat v8.26 > - Windows Terminal v1.12.10982.0 > - golang version go1.17.2 windows/amd64 > - python v3.7.7 > > colors.go > ``` > package main > > import "fmt" > > const colorReset = "\033[0m" > const colorCyan = "\033[36m" > > func main(){ > fmt.Print(string(colorCyan) + "golang-test" + string(colorReset) + "\n") > } > ``` > > > color.py > ``` > from lolpython import lol_py > > lol_py("python-test") > ``` > > > domains.txt is an empty file (from my testing, the contents of domains.txt do not affect this bug) > > ## What works: > The following commands will successfuly output in cyan color > `go run color.go` > `go build color.go && color.exe` > `go build color.go && cat domains.txt | color.exe` > `go build color.go && echo a | color.exe` > `go build color.go && type domains.txt | color.exe` > `py -3.7 color.py` > > ## What triggers the bug: > `cat domains.txt | go run color.go` > OUTPUT: `←[36mgolang-test←[0m` > > `cat domains.txt | py -3.7 color.py` > OUTPUT: `←[38;2;128;237;18mp←[0m←[38;2;139;231;12my←[0m←[38;2;150;225;8mt←[0m←[38;2;161;217;5mh←[0m←[38;2;172;209;2mo←[0m←[38;2;182;200;1mn←[0m←[38;2;192;190;1m-←[0m←[38;2;201;180;1mt←[0m←[38;2;210;170;3me←[0m←[38;2;218;159;5ms←[0m←[38;2;226;148;9mt←[0m` > > Strangely enough, golang compiled executables work perfectly, but piping `cat domains.txt | go run color.go` does not work. > The workaround I had to go with is to use Windows's built-in `type` command instead of `cat`. This was a tricky bug to track-down so I hope this report helps hahah I cannot reproduce your problem. My environment is: cygwin 3.3.5 cat 8.32 Windows Terminal 1.13.11431.0 go version go1.18.3 windows/amd64 What shell did you use? cygwin bash? cmd.exe? powershell? -- Takashi Yano

[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 27003 bytes --]


Cygwin Configuration Diagnostics
Current System Time: Tue Jun 14 05:16:08 2022

Windows 10 Single Language Ver 10.0 Build 19043 

Path:	C:\Ruby31-x64\bin
	C:\Program Files\Common Files\Oracle\Java\javapath
	C:\Program Files (x86)\Common Files\Oracle\Java\javapath
	C:\WINDOWS\system32
	C:\WINDOWS
	C:\WINDOWS\system32\WBEM
	C:\Windows\System32
	C:\Windows
	C:\Windows\System32\wbem
	C:\Windows\System32\WindowsPowerShell\v1.0\
	C:\Windows\System32\OpenSSH\
	C:\Qt\Qt5.12.12\5.12.12\mingw73_64\bin
	C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
	C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
	C:\Program Files (x86)\GnuPG\bin
	C:\Program Files\Python27\
	C:\Program Files\Python27\Scripts
	C:\Program Files\Python37\
	C:\Program Files\Python37\Scripts\
	C:\Program Files\Python39\
	C:\Program Files\Python39\Scripts\
	C:\Users\REDACTED\AppData\Roaming\Python\Python39\Scripts
	C:\Program Files\ImageMagick-7.0.10-Q16-HDRI
	C:\Program Files (x86)\Common Files\Oracle\Java\javapath
	C:\Program Files\Common Files\Oracle\Java\javapath
	C:\ProgramData\Oracle\Java\javapath
	C:\Program Files\platform-tools_r29.0.6-windows\platform-tools
	C:\Program Files\Git\cmd
	C:\Program Files\nodejs\
	C:\Program Files\scrcpy
	C:\Program Files\gs\gs9.52\bin
	C:\Program Files\gs\gs9.52\lib
	C:\Program Files\PuTTY\
	C:\Program Files\dotnet\
	C:\Program Files\Calibre2\
	C:\Program Files\sonar-scanner-4.5.0.2216-windows\bin
	C:\Program Files\CustomBinaries
	C:\Program Files\Go\bin
	C:\EAGLE_9-6-2
	C:\Strawberry\c\bin
	C:\Strawberry\perl\site\bin
	C:\Strawberry\perl\bin
	C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
	C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
	C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\
	C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\
	C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\
	C:\Program Files (x86)\Siemens\Automation\SCADA-RT_V11\WinCC\Interfaces
	C:\Program Files (x86)\Common Files\Siemens\
	C:\Program Files (x86)\Common Files\Siemens\Interfaces
	C:\Program Files (x86)\Common Files\Siemens\ACE\Interfaces
	C:\Program Files (x86)\Siemens\Automation\SCADA-RT_V11\WinCC\Bin
	C:\Program Files\Common Files\Siemens\Automation\Simatic OAM\bin
	C:\Program Files (x86)\Common Files\Siemens\Bin
	C:\Program Files (x86)\Common Files\Siemens\CommonArchi
	C:\Program Files\apache-ant-1.9.16\bin
	C:\cygwin64\bin
	C:\Program Files\Docker\Docker\resources\bin
	C:\Gradle\gradle-7.4\bin
	C:\ProgramData\chocolatey\bin
	C:\Program Files\nodejs\
	C:\Program Files\Docker\Docker\resources\bin
	C:\ProgramData\DockerDesktop\version-bin
	C:\Program Files\dotnet\
	C:\Program Files\Git\cmd
	C:\Program Files\apache-maven-3.8.5/bin
	C:\Users\REDACTED\golib\bin
	C:\Users\REDACTED\PATH SHORTCUTS
	C:\Program Files (x86)\Nmap
	C:\Users\REDACTED\AppData\Local\Microsoft\WindowsApps
	C:\Users\REDACTED\AppData\Local\GitHubDesktop\bin
	C:\Users\REDACTED\AppData\Local\Programs\Microsoft VS Code\bin
	C:\Users\REDACTED\.dotnet\tools
	C:\Users\REDACTED\AppData\Local\Microsoft\WindowsApps
	C:\Users\REDACTED\.dotnet\tools
	C:\Program Files (x86)\mitmproxy\bin
	C:\Users\REDACTED\go\bin
	C:\Users\REDACTED\AppData\Roaming\npm

Output from C:\cygwin64\bin\id.exe
UID: 197609(REDACTED)           GID: 197121(None)
197121(None)                   197622(docker-users)
197621(Siemens TIA Engineer)   197618(SIMATIC HMI)
559(Performance Log Users)     545(Users)
4(INTERACTIVE)                 66049(CONSOLE LOGON)
11(Authenticated Users)        15(This Organization)
113(Local account)             4095(CurrentSession)
66048(LOCAL)                   262154(NTLM Authentication)
401408(Medium Mandatory Level)

SysDir: C:\WINDOWS\system32
WinDir: C:\WINDOWS

Path = 'C:\Ruby31-x64\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Qt\Qt5.12.12\5.12.12\mingw73_64\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\GnuPG\bin;C:\Program Files\Python27\;C:\Program Files\Python27\Scripts;C:\Program Files\Python37\;C:\Program Files\Python37\Scripts\;C:\Program Files\Python39\;C:\Program Files\Python39\Scripts\;C:\Users\REDACTED\AppData\Roaming\Python\Python39\Scripts;C:\Program Files\ImageMagick-7.0.10-Q16-HDRI;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\platform-tools_r29.0.6-windows\platform-tools;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\scrcpy;C:\Program Files\gs\gs9.52\bin;C:\Program Files\gs\gs9.52\lib;C:\Program Files\PuTTY\;C:\Program Files\dotnet\;C:\Program Files\Calibre2\;C:\Program Files\sonar-scanner-4.5.0.2216-windows\bin;C:\Program Files\CustomBinaries;C:\Program Files\Go\bin;C:\EAGLE_9-6-2;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Siemens\Automation\SCADA-RT_V11\WinCC\Interfaces;C:\Program Files (x86)\Common Files\Siemens\;C:\Program Files (x86)\Common Files\Siemens\Interfaces;C:\Program Files (x86)\Common Files\Siemens\ACE\Interfaces;C:\Program Files (x86)\Siemens\Automation\SCADA-RT_V11\WinCC\Bin;C:\Program Files\Common Files\Siemens\Automation\Simatic OAM\bin;C:\Program Files (x86)\Common Files\Siemens\Bin;C:\Program Files (x86)\Common Files\Siemens\CommonArchi;C:\Program Files\apache-ant-1.9.16\bin;C:\cygwin64\bin;C:\Program Files\Docker\Docker\resources\bin;C:\Gradle\gradle-7.4\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\apache-maven-3.8.5/bin;C:\Users\REDACTED\golib\bin;C:\Users\REDACTED\PATH SHORTCUTS;C:\Program Files (x86)\Nmap;C:\Users\REDACTED\AppData\Local\Microsoft\WindowsApps;C:\Users\REDACTED\AppData\Local\GitHubDesktop\bin;C:\Users\REDACTED\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\REDACTED\.dotnet\tools;C:\Users\REDACTED\AppData\Local\Microsoft\WindowsApps;C:\Users\REDACTED\.dotnet\tools;C:\Program Files (x86)\mitmproxy\bin;C:\Users\REDACTED\go\bin;C:\Users\REDACTED\AppData\Roaming\npm'

ADSK_CLM_WPAD_PROXY_CHECK = 'FALSE'
ALLUSERSPROFILE = 'C:\ProgramData'
ANT_HOME = 'C:\Program Files\apache-ant-1.9.16'
APPDATA = 'C:\Users\REDACTED\AppData\Roaming'
AutInstLog = 'C:\ProgramData\Siemens\Automation\Logfiles\Setup\'
BESIEGE_GAME_ASSEMBLIES = 'C:/Program Files/Besiege/Besiege_Data\Managed/'
BESIEGE_UNITY_ASSEMBLIES = 'C:/Program Files/Besiege/Besiege_Data\Managed/'
ChocolateyInstall = 'C:\ProgramData\chocolatey'
ChocolateyLastPathUpdate = '132979020100720755'
ChocolateyToolsLocation = 'C:\tools'
CommonProgramFiles = 'C:\Program Files\Common Files'
CommonProgramFiles(x86) = 'C:\Program Files (x86)\Common Files'
CommonProgramW6432 = 'C:\Program Files\Common Files'
COMPUTERNAME = 'REDACTED'
ComSpec = 'C:\WINDOWS\system32\cmd.exe'
DOTNET_CLI_TELEMETRY_OPTOUT = '1'
dPF = 'C:\Program Files'
dPF86 = 'C:\Program Files (x86)'
DriverData = 'C:\Windows\System32\Drivers\DriverData'
GOPATH = 'C:\Users\REDACTED\golib;C:\Users\REDACTED\Documents\Go;'
HOMEDRIVE = 'C:'
HOMEPATH = '\Users\REDACTED'
JD2_HOME = 'C:\Users\REDACTED\AppData\Local\JDownloader 2.0'
LOCALAPPDATA = 'C:\Users\REDACTED\AppData\Local'
LOG4J_FORMAT_MSG_NO_LOOKUPS = 'true'
LOGONSERVER = '\\REDACTED'
M2 = 'C:\Program Files\apache-maven-3.8.5/bin'
M2_HOME = 'C:\Program Files\apache-maven-3.8.5'
MAVEN_OPTS = '-Xms256m -Xmx512m'
NUMBER_OF_PROCESSORS = '8'
OneDrive = 'C:\Users\REDACTED\OneDrive'
OneDriveConsumer = 'C:\Users\REDACTED\OneDrive'
OS = 'Windows_NT'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW'
POWERSHELL_TELEMETRY_OPTOUT = '1'
PROCESSOR_ARCHITECTURE = 'AMD64'
PROCESSOR_IDENTIFIER = 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel'
PROCESSOR_LEVEL = '6'
PROCESSOR_REVISION = '3c03'
ProgramData = 'C:\ProgramData'
ProgramFiles = 'C:\Program Files'
ProgramFiles(x86) = 'C:\Program Files (x86)'
ProgramW6432 = 'C:\Program Files'
PROMPT = '$P$G'
PSModulePath = 'C:\Program Files (x86)\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AutoIt3\AutoItX;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\'
PUBLIC = 'C:\Users\Public'
Simatic_OAM = 'C:\Program Files\Common Files\Siemens\Automation\Simatic OAM'
Simatic_OAM_DATA = 'C:\ProgramData\Siemens\Automation\Simatic OAM'
SW_SIM_HYDRA = 'C:\Program Files\Common Files\SolidWorks Shared\Simulation Worker Agent\'
SW_SIM_MPIT = 'INTELMPI'
SW_SIM_TEMP = 'C:\ProgramData\SOLIDWORKS\SW_net_sim_temp\'
SystemDrive = 'C:'
SystemRoot = 'C:\WINDOWS'
TEMP = 'C:\Users\REDACTED\AppData\Local\Temp'
TMP = 'C:\Users\REDACTED\AppData\Local\Temp'
USERDOMAIN = 'REDACTED'
USERDOMAIN_ROAMINGPROFILE = 'REDACTED'
USERNAME = 'REDACTED'
USERPROFILE = 'C:\Users\REDACTED'
VS110COMNTOOLS = 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\'
VS120COMNTOOLS = 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\'
windir = 'C:\WINDOWS'
WIX = 'C:\Program Files (x86)\WiX Toolset v3.11\'
WSLENV = 'WT_SESSION::WT_PROFILE_ID'
WT_PROFILE_ID = '{0caa0dad-35be-5f56-a8ff-afceeeaa6101}'
WT_SESSION = 'e1bf0d2f-4595-4366-a214-d8a15974e4e5'

HKEY_CURRENT_USER\SOFTWARE\Cygwin
HKEY_CURRENT_USER\SOFTWARE\Cygwin\Installations
  (default) = '\??\C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Installations
  (default) = '\??\C:\Program Files'
  e022582115c10879 = '\??\C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup
  (default) = 'C:\cygwin64'

obcaseinsensitive set to 1

Cygwin installations found in the registry:
  System: Key: 5582d5bf6400eea2 Path: C:\Program Files (ORPHANED)
  System: Key: e022582115c10879 Path: C:\cygwin64
  User:   Key: e022582115c10879 Path: C:\cygwin64

c:  hd  NTFS    952186Mb  81% CP CS UN PA FC    QU  
e:  cd             N/A    N/A                       

C:\cygwin64      /          system  binary,auto
C:\cygwin64\bin  /usr/bin   system  binary,auto
C:\cygwin64\lib  /usr/lib   system  binary,auto
cygdrive prefix  /cygdrive  user    binary,posix=0,auto

Found: C:\cygwin64\bin\awk
 -> C:\cygwin64\bin\gawk.exe
Found: C:\WINDOWS\system32\bash.exe
Found: C:\Windows\System32\bash.exe
Found: C:\cygwin64\bin\bash.exe
Warning: C:\WINDOWS\system32\bash.exe hides C:\cygwin64\bin\bash.exe
Found: C:\cygwin64\bin\cat.exe
Found: C:\WINDOWS\system32\certutil.exe
Found: C:\Windows\System32\certutil.exe
Not Found: clinfo
Found: C:\WINDOWS\system32\comp.exe
Found: C:\Windows\System32\comp.exe
Found: C:\WINDOWS\system32\convert.exe
Found: C:\Windows\System32\convert.exe
Found: C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\convert.exe
Warning: C:\WINDOWS\system32\convert.exe hides C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\convert.exe
Found: C:\cygwin64\bin\cp.exe
Found: C:\Strawberry\c\bin\cpp.exe
Not Found: crontab
Found: C:\WINDOWS\system32\curl.exe
Found: C:\Windows\System32\curl.exe
Found: C:\WINDOWS\system32\expand.exe
Found: C:\Windows\System32\expand.exe
Found: C:\cygwin64\bin\expand.exe
Warning: C:\WINDOWS\system32\expand.exe hides C:\cygwin64\bin\expand.exe
Found: C:\WINDOWS\system32\find.exe
Found: C:\Windows\System32\find.exe
Found: C:\cygwin64\bin\find.exe
Warning: C:\WINDOWS\system32\find.exe hides C:\cygwin64\bin\find.exe
Found: C:\WINDOWS\system32\ftp.exe
Found: C:\Windows\System32\ftp.exe
Found: C:\Strawberry\c\bin\gcc.exe
Found: C:\Strawberry\c\bin\gdb.exe
Found: C:\cygwin64\bin\grep.exe
Found: C:\WINDOWS\system32\hostname.exe
Found: C:\Windows\System32\hostname.exe
Found: C:\cygwin64\bin\hostname.exe
Warning: C:\WINDOWS\system32\hostname.exe hides C:\cygwin64\bin\hostname.exe
Found: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\kill.exe
Found: C:\cygwin64\bin\kill.exe
Warning: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\kill.exe hides C:\cygwin64\bin\kill.exe
Found: C:\WINDOWS\system32\klist.exe
Found: C:\Windows\System32\klist.exe
Found: C:\Strawberry\c\bin\ld.exe
Found: C:\cygwin64\bin\ls.exe
Found: C:\cygwin64\bin\make.exe
Found: C:\cygwin64\bin\mv.exe
Found: C:\WINDOWS\system32\nslookup.exe
Found: C:\Windows\System32\nslookup.exe
Found: C:\Strawberry\c\bin\patch.exe
Found: C:\Strawberry\perl\bin\perl.exe
Found: C:\WINDOWS\system32\replace.exe
Found: C:\Windows\System32\replace.exe
Found: C:\cygwin64\bin\rm.exe
Found: C:\cygwin64\bin\sed.exe
Found: C:\cygwin64\bin\sh.exe
Found: C:\WINDOWS\system32\shutdown.exe
Found: C:\Windows\System32\shutdown.exe
Found: C:\WINDOWS\system32\sort.exe
Found: C:\Windows\System32\sort.exe
Found: C:\cygwin64\bin\sort.exe
Warning: C:\WINDOWS\system32\sort.exe hides C:\cygwin64\bin\sort.exe
Found: C:\Windows\System32\OpenSSH\ssh.exe
Found: C:\WINDOWS\system32\tar.exe
Found: C:\Windows\System32\tar.exe
Found: C:\cygwin64\bin\tar.exe
Warning: C:\WINDOWS\system32\tar.exe hides C:\cygwin64\bin\tar.exe
Found: C:\cygwin64\bin\test.exe
Found: C:\WINDOWS\system32\timeout.exe
Found: C:\Windows\System32\timeout.exe
Found: C:\cygwin64\bin\timeout.exe
Warning: C:\WINDOWS\system32\timeout.exe hides C:\cygwin64\bin\timeout.exe
Found: C:\cygwin64\bin\vi.exe
Not Found: vim
Found: C:\WINDOWS\system32\whoami.exe
Found: C:\Windows\System32\whoami.exe
Found: C:\cygwin64\bin\whoami.exe
Warning: C:\WINDOWS\system32\whoami.exe hides C:\cygwin64\bin\whoami.exe

   39k 2016/09/19 C:\cygwin64\bin\cygargp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygargp-0.dll" v0.0 ts=2016-09-18 22:13
   19k 2018/12/20 C:\cygwin64\bin\cygattr-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygattr-1.dll" v0.0 ts=2018-12-20 06:48
  254k 2020/03/31 C:\cygwin64\bin\cygblkid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygblkid-1.dll" v0.0 ts=2020-03-28 02:22
   66k 2019/07/21 C:\cygwin64\bin\cygbz2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygbz2-1.dll" v0.0 ts=2019-07-21 20:05
  193k 2021/05/20 C:\cygwin64\bin\cygcrypt-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypt-2.dll" v0.0 ts=2021-05-20 05:38
 2489k 2021/11/28 C:\cygwin64\bin\cygcrypto-1.1.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypto-1.1.dll" v0.0 ts=2021-11-28 13:59
  353k 2020/03/31 C:\cygwin64\bin\cygfdisk-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygfdisk-1.dll" v0.0 ts=2020-03-28 02:23
   27k 2015/11/17 C:\cygwin64\bin\cygffi-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygffi-6.dll" v0.0 ts=2015-11-17 19:14
   56k 2019/07/28 C:\cygwin64\bin\cygformw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygformw-10.dll" v0.0 ts=2019-07-28 13:33
  146k 2021/10/13 C:\cygwin64\bin\cyggc-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggc-1.dll" v0.0 ts=2021-10-13 02:55
   74k 2021/08/22 C:\cygwin64\bin\cyggcc_s-seh-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcc_s-seh-1.dll" v0.0 ts=2021-08-22 05:49
   49k 2019/07/10 C:\cygwin64\bin\cyggdbm-6.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm-6.dll" v0.0 ts=2019-07-10 10:53
  582k 2021/08/21 C:\cygwin64\bin\cyggmp-10.dll - os=4.0 img=0.0 sys=5.2
                  "cyggmp-10.dll" v0.0 ts=2021-08-21 15:11
 1070k 2020/03/13 C:\cygwin64\bin\cygguile-2.2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygguile-2.2-1.dll" v0.0 ts=2020-03-08 17:47
   36k 2021/08/31 C:\cygwin64\bin\cyghistory7.dll - os=4.0 img=0.0 sys=5.2
                  "cyghistory7.dll" v0.0 ts=2021-08-31 03:54
 1007k 2020/07/13 C:\cygwin64\bin\cygiconv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiconv-2.dll" v0.0 ts=2020-07-13 09:57
   42k 2021/07/29 C:\cygwin64\bin\cygintl-8.dll - os=4.0 img=0.0 sys=5.2
                  "cygintl-8.dll" v0.0 ts=2021-07-28 23:40
 1695k 2021/08/21 C:\cygwin64\bin\cygisl-23.dll - os=4.0 img=0.0 sys=5.2
                  "cygisl-23.dll" v0.0 ts=2021-08-21 14:50
  322k 2019/04/29 C:\cygwin64\bin\cygjq-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygjq-1.dll" v0.0 ts=2019-04-29 16:54
   36k 2021/11/16 C:\cygwin64\bin\cygltdl-7.dll - os=4.0 img=0.0 sys=5.2
                  "cygltdl-7.dll" v0.0 ts=2021-11-16 11:27
   73k 2017/06/19 C:\cygwin64\bin\cyglz4-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyglz4-1.dll" v0.0 ts=2017-06-19 11:40
  144k 2019/07/21 C:\cygwin64\bin\cyglzma-5.dll - os=4.0 img=0.0 sys=5.2
                  "cyglzma-5.dll" v0.0 ts=2019-07-21 20:15
  157k 2022/01/12 C:\cygwin64\bin\cygmagic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygmagic-1.dll" v0.0 ts=2022-01-12 06:43
  210k 2021/11/28 C:\cygwin64\bin\cygman-2-9-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygman-2-9-4.dll" v0.0 ts=2021-11-28 13:11
   24k 2021/11/28 C:\cygwin64\bin\cygmandb-2-9-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygmandb-2-9-4.dll" v0.0 ts=2021-11-28 13:11
   28k 2019/07/28 C:\cygwin64\bin\cygmenuw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygmenuw-10.dll" v0.0 ts=2019-07-28 13:32
  100k 2021/08/21 C:\cygwin64\bin\cygmpc-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpc-3.dll" v0.0 ts=2021-08-21 15:35
 2663k 2021/08/21 C:\cygwin64\bin\cygmpfr-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpfr-6.dll" v0.0 ts=2021-08-21 15:01
  301k 2019/07/28 C:\cygwin64\bin\cygncursesw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncursesw-10.dll" v0.0 ts=2019-07-28 13:30
  514k 2019/12/20 C:\cygwin64\bin\cygonig-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygonig-5.dll" v0.0 ts=2019-12-20 03:48
 1020k 2020/03/27 C:\cygwin64\bin\cygp11-kit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygp11-kit-0.dll" v0.0 ts=2020-03-27 18:30
   14k 2019/07/28 C:\cygwin64\bin\cygpanelw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygpanelw-10.dll" v0.0 ts=2019-07-28 13:32
  497k 2021/06/20 C:\cygwin64\bin\cygpcre-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpcre-1.dll" v0.0 ts=2021-06-20 08:53
  601k 2021/11/01 C:\cygwin64\bin\cygpcre2-8-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpcre2-8-0.dll" v0.0 ts=2021-11-01 13:58
   42k 2020/12/27 C:\cygwin64\bin\cygpipeline-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpipeline-1.dll" v0.0 ts=2020-12-27 11:15
   42k 2020/12/31 C:\cygwin64\bin\cygpopt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpopt-0.dll" v0.0 ts=2020-12-31 09:16
  254k 2021/08/31 C:\cygwin64\bin\cygreadline7.dll - os=4.0 img=0.0 sys=5.2
                  "cygreadline7.dll" v0.0 ts=2021-08-31 03:54
   11k 2015/07/17 C:\cygwin64\bin\cygsigsegv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygsigsegv-2.dll" v0.0 ts=2015-07-17 18:35
  156k 2020/03/31 C:\cygwin64\bin\cygsmartcols-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygsmartcols-1.dll" v0.0 ts=2020-03-28 02:22
  511k 2021/11/28 C:\cygwin64\bin\cygssl-1.1.dll - os=4.0 img=0.0 sys=5.2
                  "cygssl-1.1.dll" v0.0 ts=2021-11-28 14:00
 1869k 2021/08/22 C:\cygwin64\bin\cygstdc++-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygstdc++-6.dll" v0.0 ts=2021-08-22 06:08
   68k 2019/07/29 C:\cygwin64\bin\cygtasn1-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtasn1-6.dll" v0.0 ts=2019-07-28 23:12
   57k 2019/07/28 C:\cygwin64\bin\cygticw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygticw-10.dll" v0.0 ts=2019-07-28 13:31
 1612k 2018/08/16 C:\cygwin64\bin\cygunistring-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygunistring-2.dll" v0.0 ts=2018-08-16 16:33
   27k 2020/03/31 C:\cygwin64\bin\cyguuid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyguuid-1.dll" v0.0 ts=2020-03-28 02:22
   83k 2017/03/03 C:\cygwin64\bin\cygz.dll - os=4.0 img=0.0 sys=5.2
                  "cygz.dll" v0.0 ts=2017-03-03 18:42
  624k 2022/01/22 C:\cygwin64\bin\cygzstd-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygzstd-1.dll" v0.0 ts=2022-01-22 14:21
 3472k 2022/01/31 C:\cygwin64\bin\cygwin1.dll - os=4.0 img=0.0 sys=5.2
                  "cygwin1.dll" v0.0 ts=2022-01-31 16:35
    Cygwin DLL version info:
        DLL version: 3.3.4
        DLL epoch: 19
        DLL old termios: 5
        DLL malloc env: 28
        Cygwin conv: 181
        API major: 0
        API minor: 341
        Shared data: 5
        DLL identifier: cygwin1
        Mount registry: 3
        Cygwin registry name: Cygwin
        Installations name: Installations
        Cygdrive default prefix: 
        Build date: 
        Shared id: cygwin1S5


Can't find the cygrunsrv utility, skipping services check.


Cygwin Package Information
Last downloaded files to: C:\Users\REDACTED\Downloads\cygwin_temp
Last downloaded files from: ftp://mirrors.dotsrc.org/mirrors/cygwin/

Package                                 Version            Status
_autorebase                             001091-1           OK
alternatives                            1.3.30c-10         OK
base-cygwin                             3.8-1              OK
base-files                              4.3-3              OK
bash                                    4.4.12-3           OK
bzip2                                   1.0.8-1            OK
ca-certificates                         2021.2.52-1        OK
coreutils                               8.26-2             OK
crypto-policies                         20190218-1         OK
cygutils                                1.4.17-1           OK
cygwin                                  3.3.4-2            OK
dash                                    0.5.11.5-1         OK
diffutils                               3.8-1              OK
editrights                              1.03-1             OK
figlet                                  2.2.2-2            OK
file                                    5.41-2             OK
findutils                               4.8.0-1            OK
gawk                                    5.1.1-1            OK
getent                                  2.18.90-4          OK
grep                                    3.7-2              OK
groff                                   1.22.4-1           OK
gzip                                    1.11-1             OK
hostname                                3.13-1             OK
info                                    6.8-2              OK
ipc-utils                               1.0-2              OK
jq                                      1.6-1              OK
less                                    590-1              OK
libargp                                 20110921-3         OK
libattr1                                2.4.48-2           OK
libblkid1                               2.33.1-2           OK
libbz2_1                                1.0.8-1            OK
libcrypt2                               4.4.20-1           OK
libfdisk1                               2.33.1-2           OK
libffi6                                 3.2.1-2            OK
libgc1                                  8.0.6-1            OK
libgcc1                                 11.2.0-1           OK
libgdbm6                                1.18.1-1           OK
libgmp10                                6.2.1-2            OK
libguile2.2_1                           2.2.7-1            OK
libiconv2                               1.16-2             OK
libintl8                                0.21-1             OK
libisl23                                0.24-2             OK
libjq1                                  1.6-1              OK
libltdl7                                2.4.6-8            OK
liblz4_1                                1.7.5-1            OK
liblzma5                                5.2.4-1            OK
libmpc3                                 1.2.1-2            OK
libmpfr6                                4.1.0-2            OK
libncursesw10                           6.1-1.20190727     OK
libonig5                                6.9.4-1            OK
libp11-kit0                             0.23.20-1          OK
libpcre1                                8.45-1             OK
libpcre2_8_0                            10.39-1            OK
libpipeline1                            1.5.3-1            OK
libpopt-common                          1.18-1             OK
libpopt0                                1.18-1             OK
libreadline7                            8.1-2              OK
libsigsegv2                             2.10-2             OK
libsmartcols1                           2.33.1-2           OK
libssl1.1                               1.1.1l-2           OK
libstdc++6                              11.2.0-1           OK
libtasn1_6                              4.14-1             OK
libunistring2                           0.9.10-1           OK
libuuid1                                2.33.1-2           OK
libzstd1                                1.5.2-1            OK
login                                   1.13-1             OK
make                                    4.3-1              OK
man-db                                  2.9.4-2.1          OK
mingw64-x86_64-binutils                 2.37-2             OK
mingw64-x86_64-gcc-core                 11.2.0-1           OK
mingw64-x86_64-gcc-g++                  11.2.0-1           OK
mingw64-x86_64-headers                  9.0.0-1            OK
mingw64-x86_64-runtime                  9.0.0-1            OK
mingw64-x86_64-windows-default-manifest 6.4-1              OK
mingw64-x86_64-winpthreads              9.0.0-1            OK
mintty                                  3.5.2-1            OK
ncurses                                 6.1-1.20190727     OK
openssl                                 1.1.1l-2           OK
p11-kit                                 0.23.20-1          OK
p11-kit-trust                           0.23.20-1          OK
rebase                                  4.5.0-1            OK
run                                     1.3.4-2            OK
sed                                     4.8-1              OK
tar                                     1.34-1             OK
terminfo                                6.1-1.20190727     OK
terminfo-extra                          6.1-1.20190727     OK
tzcode                                  2021e-1            OK
tzdata                                  2021e-1            OK
util-linux                              2.33.1-2           OK
vim-minimal                             8.2.3755-1         OK
which                                   2.20-2             OK
xz                                      5.2.4-1            OK
zlib0                                   1.2.11-1           OK
zstd                                    1.5.2-1            OK
Use -h to see help about each section

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
  2022-06-14 21:53   ` 5990
@ 2022-06-14 21:56     ` 5990
  2022-06-15  1:04       ` Takashi Yano
  0 siblings, 1 reply; 6+ messages in thread
From: 5990 @ 2022-06-14 21:56 UTC (permalink / raw)
  To: takashi.yano, cygwin

Ignore my previous email; I forgot to enable plain text mode.

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.

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?

By the way, I've attached my cygcheck.out; I forgot to attach it at first. I've redacted my username and computer name.

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`



Sent with Proton Mail secure email.
------- Original Message -------
On Tuesday, June 14th, 2022 at 9:53 PM, 5990 <5990@protonmail.com> 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.
>
> 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?
> By the way, I've attached my cygcheck.out; I forgot to attach it at first. I've redacted my username and computer name.
>
> 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`
> -------- Original Message --------
> On Jun. 14, 2022, 7:47 a.m., Takashi Yano < takashi.yano@nifty.ne.jp> wrote:
>
> >
> > On Tue, 14 Jun 2022 08:01:45 +0000 5990 via Cygwin wrote: > ## Bug: > Piping the standard output of cat into the standard input of golang or python, makes the Windows Terminal render ANSI codes as arrows. > > For example: > `\033[36m` turns into `←[36m` (or in base64'd UNICODE: `4oaQWzM2bQ==`) > > ## Environment: > - cat v8.26 > - Windows Terminal v1.12.10982.0 > - golang version go1.17.2 windows/amd64 > - python v3.7.7 > > colors.go > ``` > package main > > import "fmt" > > const colorReset = "\033[0m" > const colorCyan = "\033[36m" > > func main(){ > fmt.Print(string(colorCyan) + "golang-test" + string(colorReset) + "\n") > } > ``` > > > color.py > ``` > from lolpython import lol_py > > lol_py("python-test") > ``` > > > domains.txt is an empty file (from my testing, the contents of domains.txt do not affect this bug) > > ## What works: > The following commands will successfuly output in cyan color > `go run color.go` > `go build color.go && color.exe` > `go build color.go && cat domains.txt | color.exe` > `go build color.go && echo a | color.exe` > `go build color.go && type domains.txt | color.exe` > `py -3.7 color.py` > > ## What triggers the bug: > `cat domains.txt | go run color.go` > OUTPUT: `←[36mgolang-test←[0m` > > `cat domains.txt | py -3.7 color.py` > OUTPUT: `←[38;2;128;237;18mp←[0m←[38;2;139;231;12my←[0m←[38;2;150;225;8mt←[0m←[38;2;161;217;5mh←[0m←[38;2;172;209;2mo←[0m←[38;2;182;200;1mn←[0m←[38;2;192;190;1m-←[0m←[38;2;201;180;1mt←[0m←[38;2;210;170;3me←[0m←[38;2;218;159;5ms←[0m←[38;2;226;148;9mt←[0m` > > Strangely enough, golang compiled executables work perfectly, but piping `cat domains.txt | go run color.go` does not work. > The workaround I had to go with is to use Windows's built-in `type` command instead of `cat`. This was a tricky bug to track-down so I hope this report helps hahah I cannot reproduce your problem. My environment is: cygwin 3.3.5 cat 8.32 Windows Terminal 1.13.11431.0 go version go1.18.3 windows/amd64 What shell did you use? cygwin bash? cmd.exe? powershell? -- Takashi Yano

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
  2022-06-14 21:56     ` 5990
@ 2022-06-15  1:04       ` Takashi Yano
  2022-06-15  4:42         ` Takashi Yano
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Yano @ 2022-06-15  1:04 UTC (permalink / raw)
  To: cygwin; +Cc: 5990

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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang
  2022-06-15  1:04       ` Takashi Yano
@ 2022-06-15  4:42         ` Takashi Yano
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Yano @ 2022-06-15  4:42 UTC (permalink / raw)
  To: cygwin

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-15  4:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  8:01 "cat" breaks ANSI codes on Windows Terminal when piping stdout to python or golang 5990
2022-06-14 10:47 ` Takashi Yano
2022-06-14 21:53   ` 5990
2022-06-14 21:56     ` 5990
2022-06-15  1:04       ` Takashi Yano
2022-06-15  4:42         ` Takashi Yano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).