##// END OF EJS Templates
atexit: switch to home-grown implementation
Bryan O'Sullivan -
r31958:de5c9d0e default
parent child Browse files
Show More
@@ -12,7 +12,6 b' prints it to ``stderr`` on exit.'
12 '''
12 '''
13
13
14 from __future__ import absolute_import
14 from __future__ import absolute_import
15 import atexit
16
15
17 def memusage(ui):
16 def memusage(ui):
18 """Report memory usage of the current process."""
17 """Report memory usage of the current process."""
@@ -29,4 +28,4 b' def memusage(ui):'
29 for k, v in result.iteritems()]) + "\n")
28 for k, v in result.iteritems()]) + "\n")
30
29
31 def extsetup(ui):
30 def extsetup(ui):
32 atexit.register(memusage, ui)
31 ui.atexit(memusage, ui)
@@ -7,7 +7,6 b''
7
7
8 from __future__ import absolute_import, print_function
8 from __future__ import absolute_import, print_function
9
9
10 import atexit
11 import difflib
10 import difflib
12 import errno
11 import errno
13 import getopt
12 import getopt
@@ -767,7 +766,7 b' def _dispatch(req):'
767 ui.warn(
766 ui.warn(
768 _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
767 _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
769 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
768 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
770 atexit.register(print_time)
769 ui.atexit(print_time)
771
770
772 if options['verbose'] or options['debug'] or options['quiet']:
771 if options['verbose'] or options['debug'] or options['quiet']:
773 for opt in ('verbose', 'debug', 'quiet'):
772 for opt in ('verbose', 'debug', 'quiet'):
@@ -7,7 +7,6 b''
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
@@ -937,7 +936,7 b' class ui(object):'
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)
General Comments 0
You need to be logged in to leave comments. Login now