diff --git a/bin/emerge b/bin/emerge index 5d74bfa..2e9b723 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3,6 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function +from portage.output import xtermTitleCont import sys # This block ensures that ^C interrupts are handled quietly. @@ -19,6 +20,7 @@ try: # Prevent "[Errno 32] Broken pipe" exceptions when # writing to a pipe. signal.signal(signal.SIGPIPE, signal.SIG_DFL) + signal.signal(signal.SIGCONT, xtermTitleCont) except KeyboardInterrupt: sys.exit(1) diff --git a/pym/portage/output.py b/pym/portage/output.py index 0dc218e..c54be83 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -239,8 +239,21 @@ _legal_terms_re = re.compile(r'^(xterm|xterm-color|Eterm|aterm|rxvt|screen|kterm _disable_xtermTitle = None _max_xtermTitle_len = 253 +prev_title = None +prev_raw = False +def xtermTitleCont(signum, frame): + # Restore last written xterm title on SIGCONT + xtermTitle(prev_title, prev_raw) + def xtermTitle(mystr, raw=False): global _disable_xtermTitle + global prev_title + global prev_raw + + # Store title, so it can be restored on SIGCONT + prev_title = mystr + prev_raw = raw + if _disable_xtermTitle is None: _disable_xtermTitle = not (sys.stderr.isatty() and \ 'TERM' in os.environ and \