Skip to content

Commit 45f8f12

Browse files
committed
Extend the search for a terminal name and version
Testing out Contour, it does things a little differently again. This will take this into account and will report Contour and its version.
1 parent f4a7329 commit 45f8f12

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/textual_dev/tools/diagnose.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def _guess_term() -> str:
6666
The best guess at the name of the terminal.
6767
"""
6868

69-
# First obvious place to look is in $TERM_PROGRAM.
70-
term_program = os.environ.get("TERM_PROGRAM")
69+
# Look in a couple of generic locations for the name of the terminal.
70+
term_program = os.environ.get("TERM_PROGRAM") or os.environ.get("TERMINAL_NAME")
7171

7272
if term_program is None:
7373
# Seems we couldn't get it that way. Let's check for some of the
@@ -87,7 +87,9 @@ def _guess_term() -> str:
8787

8888
else:
8989
# See if we can pull out some sort of version information too.
90-
term_version = os.environ.get("TERM_PROGRAM_VERSION")
90+
term_version = os.environ.get("TERM_PROGRAM_VERSION") or os.environ.get(
91+
"TERMINAL_VERSION_STRING"
92+
)
9193
if term_version is not None:
9294
term_program = f"{term_program} ({term_version})"
9395

0 commit comments

Comments
 (0)