commit: 148a62e8c2d0690f27dde9c46747e49dd1889595 Author: steering7253 <steering7253 <AT> proton <DOT> me> AuthorDate: Sat Jul 5 10:00:32 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Sep 11 00:52:57 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=148a62e8
Hostname support in titles without exporting HOSTNAME from your shell Signed-off-by: John Runyon <steering7253 <AT> proton.me> Part-of: https://github.com/gentoo/portage/pull/1448 Closes: https://github.com/gentoo/portage/pull/1448 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/output.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/portage/output.py b/lib/portage/output.py index 27da869b86..cbf13a9d20 100644 --- a/lib/portage/output.py +++ b/lib/portage/output.py @@ -6,6 +6,7 @@ __docformat__ = "epytext" import errno import itertools import re +import socket import subprocess import sys from typing import Optional @@ -282,8 +283,8 @@ def xtermTitle(mystr, raw=False): ) if dotitles and not _disable_xtermTitle: - if "HOSTNAME" in os.environ and not raw: - hostname = os.environ["HOSTNAME"] + if not raw: + hostname = socket.gethostname() mystr = f"{hostname}: {mystr}" # If the title string is too big then the terminal can # misbehave. Therefore, truncate it if it's too big.
