mercurial/ui.py
changeset 50898 29ce50726ce0
parent 50765 7f8f6fe13fa9
child 50928 d718eddf01d9
equal deleted inserted replaced
50897:6ca865080479 50898:29ce50726ce0
  1465             b'starting pager for command %s\n' % stringutil.pprint(command)
  1465             b'starting pager for command %s\n' % stringutil.pprint(command)
  1466         )
  1466         )
  1467         self.flush()
  1467         self.flush()
  1468 
  1468 
  1469         wasformatted = self.formatted()
  1469         wasformatted = self.formatted()
  1470         if util.safehasattr(signal, b"SIGPIPE"):
  1470         if util.safehasattr(signal, "SIGPIPE"):
  1471             signal.signal(signal.SIGPIPE, _catchterm)
  1471             signal.signal(signal.SIGPIPE, _catchterm)
  1472         if self._runpager(pagercmd, pagerenv):
  1472         if self._runpager(pagercmd, pagerenv):
  1473             self.pageractive = True
  1473             self.pageractive = True
  1474             # Preserve the formatted-ness of the UI. This is important
  1474             # Preserve the formatted-ness of the UI. This is important
  1475             # because we mess with stdout, which might confuse
  1475             # because we mess with stdout, which might confuse
  1545         if self._isatty(procutil.stderr):
  1545         if self._isatty(procutil.stderr):
  1546             os.dup2(pager.stdin.fileno(), procutil.stderr.fileno())
  1546             os.dup2(pager.stdin.fileno(), procutil.stderr.fileno())
  1547 
  1547 
  1548         @self.atexit
  1548         @self.atexit
  1549         def killpager():
  1549         def killpager():
  1550             if util.safehasattr(signal, b"SIGINT"):
  1550             if util.safehasattr(signal, "SIGINT"):
  1551                 signal.signal(signal.SIGINT, signal.SIG_IGN)
  1551                 signal.signal(signal.SIGINT, signal.SIG_IGN)
  1552             # restore original fds, closing pager.stdin copies in the process
  1552             # restore original fds, closing pager.stdin copies in the process
  1553             os.dup2(stdoutfd, procutil.stdout.fileno())
  1553             os.dup2(stdoutfd, procutil.stdout.fileno())
  1554             os.dup2(stderrfd, procutil.stderr.fileno())
  1554             os.dup2(stderrfd, procutil.stderr.fileno())
  1555             pager.stdin.close()
  1555             pager.stdin.close()