yachalk icon indicating copy to clipboard operation
yachalk copied to clipboard

Windows 10 Command Prompt support?

Open bfailing opened this issue 3 years ago • 2 comments

It doesn't work in Windows 10 Command Prompt without first adding the following:

import os
os.system('')

Is that the expected behavior? If so, can something like the above be added to the library?

bfailing avatar Nov 21 '21 21:11 bfailing

Unfortunately, I have no experience with Windows. Basically all that is needed is a terminal with standard ANSI escape code support. I had also noticed this hint in the original chalk documentation. It is quite weird though that running an empty os.system (what is that launching actually?) can have such a side effect. I'm afraid I can be of much help in this case, because I don't have access to Windows, and this sounds like an idiosyncrasy of that terminal.

bluenote10 avatar Nov 21 '21 23:11 bluenote10

Yeah, this is a really wicked thing, that can't be explained without diving into the source code of that (Windows) python library. You can look at some related technical discussion about UTF-8 with and without BOM, and how it affects the Powershell's [native vs Core] differently and does weird stuff to the terminal, depending...

See:

  • https://github.com/PowerShell/PowerShell/issues/7233
  • https://github.com/python/cpython/blob/99fcf1505218464c489d419d4500f126b6d6dc28/Modules/clinic/posixmodule.c.h#L1733

eabase avatar Dec 29 '21 01:12 eabase