comparison mercurial/ui.py @ 31958:de5c9d0e02ea

atexit: switch to home-grown implementation
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 11 Apr 2017 14:54:12 -0700
parents c13ff31818b0
children db823e38a61c
comparison
equal deleted inserted replaced
31957:84f9eb9758c0 31958:de5c9d0e02ea
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9 9
10 import atexit
11 import collections 10 import collections
12 import contextlib 11 import contextlib
13 import errno 12 import errno
14 import getpass 13 import getpass
15 import inspect 14 import inspect
935 934
936 os.dup2(pager.stdin.fileno(), util.stdout.fileno()) 935 os.dup2(pager.stdin.fileno(), util.stdout.fileno())
937 if self._isatty(util.stderr): 936 if self._isatty(util.stderr):
938 os.dup2(pager.stdin.fileno(), util.stderr.fileno()) 937 os.dup2(pager.stdin.fileno(), util.stderr.fileno())
939 938
940 @atexit.register 939 @self.atexit
941 def killpager(): 940 def killpager():
942 if util.safehasattr(signal, "SIGINT"): 941 if util.safehasattr(signal, "SIGINT"):
943 signal.signal(signal.SIGINT, signal.SIG_IGN) 942 signal.signal(signal.SIGINT, signal.SIG_IGN)
944 # restore original fds, closing pager.stdin copies in the process 943 # restore original fds, closing pager.stdin copies in the process
945 os.dup2(stdoutfd, util.stdout.fileno()) 944 os.dup2(stdoutfd, util.stdout.fileno())