Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tty / color support on Windows #2819

Closed
schlamar opened this issue Jan 4, 2023 · 5 comments
Closed

No tty / color support on Windows #2819

schlamar opened this issue Jan 4, 2023 · 5 comments
Labels
area:documentation help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@schlamar
Copy link

schlamar commented Jan 4, 2023

Issue

Color output in Windows from tools does not work as expected.

Expected output:

image

Actual output within tox:

image

This should have been fixed by @masenf in #2711 So maybe there was a regression since then.

Environment

Provide at least:

  • OS: Windows
  • pip list of the host Python where tox is installed:
Package       Version
------------- -------
cachetools    5.2.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.9.0
packaging     22.0
pip           22.3.1
platformdirs  2.6.2
pluggy        1.0.0
pyproject_api 1.4.0
setuptools    65.6.3
tomli         2.0.1
tox           4.2.1
virtualenv    20.17.1
wheel         0.38.4

Minimal example

If possible, provide a minimal reproducer for the issue:

[testenv]
deps = pytest
commands =
    python -c 'import sys; print("sys.stdout.isatty(): %s" % sys.stdout.isatty()); print("to stdout, should be colorless\n"); print("sys.stderr.isatty(): %s" % sys.stderr.isatty());        print("to stderr, should be red?\n", file=sys.stderr)'
    pytest {posargs}

test_test.py

def test():
    assert False
@schlamar
Copy link
Author

schlamar commented Jan 4, 2023

Maybe the implementation from @masenf does not support Windows, but in this case merging #2816 was wrong.

@masenf
Copy link
Collaborator

masenf commented Jan 4, 2023

On my windows Python 3.11 installation, the termios stdlib module is not available, and thus #2711 would not actually have an effect on windows: https://github.com/tox-dev/tox/pull/2711/files#diff-7db0796890e2c916e1d687a28bb382fe2c3a359eef2080621f3e5b3b8cca4927R293-R295

I wouldn't consider this a regression from #2711, but it is a regression from tox 3, which didn't do output capturing of the main commands and thus didn't have to deal with tty allocation in order to get colorized and interactive output.

We should leave this issue open to fix tty allocation on windows platform.

@schlamar
Copy link
Author

schlamar commented Jan 4, 2023

In this case this is probably a duplicate of #2337

However, you should revert #2816 or better clarify in the documentation that this is still an issue on Windows.

@masenf
Copy link
Collaborator

masenf commented Jan 4, 2023

Adding TTY support for windows (#2337) is far from trivial because even though there is a new ConPTY interface in Win10, it does not return a handle that can be passed to subprocess. Likely would need an entirely separate implementation.

I think the doc change in #2816 should be reverted and changed to mention that the regression only affects windows (and probably reference 2337 there, for users that want to find out why)

@gaborbernat
Copy link
Member

@adamchainz can you add a PR with this amendment?

@gaborbernat gaborbernat added area:documentation help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. labels Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:documentation help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

3 participants