Skip to content

Commit 19c67b9

Browse files
authored
Merge pull request #4077 from Textualize/isattry
proxy isatty
2 parents 58ac151 + 494b795 commit 19c67b9

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
- Fixed empty print ignoring the `end` parameter
1818
- Fixed `Text.from_ansi` removing newlines https://github.com/Textualize/rich/pull/4076
19+
- Fixed `FileProxy.isatty` not proxying https://github.com/Textualize/rich/pull/4077
1920

2021
## [14.3.4] - 2026-04-11
2122

‎rich/file_proxy.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ def flush(self) -> None:
5555

5656
def fileno(self) -> int:
5757
return self.__file.fileno()
58+
59+
def isatty(self) -> bool:
60+
return self.__file.isatty()

‎tests/test_file_proxy.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,20 @@ def test_new_lines():
3535
assert file.getvalue() == "-\n"
3636
file_proxy.flush()
3737
assert file.getvalue() == "-\n-\n"
38+
39+
40+
def test_isatty():
41+
"""Check isatty is proxied
42+
43+
Regression test for https://github.com/Textualize/rich/issues/4041
44+
45+
"""
46+
47+
class TTYFile:
48+
def isatty(self) -> bool:
49+
return True
50+
51+
file = TTYFile()
52+
console = Console()
53+
file_proxy = FileProxy(console, file)
54+
assert file_proxy.isatty()

0 commit comments

Comments
 (0)