diff options
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/cppTests.py | 3 | ||||
| -rw-r--r-- | src/engine/SCons/exitfuncs.py | 19 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py index bfb0b46..2f2025b 100644 --- a/src/engine/SCons/cppTests.py +++ b/src/engine/SCons/cppTests.py @@ -23,6 +23,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import atexit import sys import unittest @@ -608,7 +609,7 @@ def _clean(): if os.path.exists(dir): shutil.rmtree(dir) -sys.exitfunc = _clean +atexit.register(_clean) class fileTestCase(unittest.TestCase): cpp_class = cpp.DumbPreProcessor diff --git a/src/engine/SCons/exitfuncs.py b/src/engine/SCons/exitfuncs.py index 250dd54..7d00df7 100644 --- a/src/engine/SCons/exitfuncs.py +++ b/src/engine/SCons/exitfuncs.py @@ -30,6 +30,7 @@ Register functions which are executed when SCons exits for any reason. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import atexit _exithandlers = [] def _run_exitfuncs(): @@ -52,23 +53,9 @@ def register(func, *targs, **kargs): """ _exithandlers.append((func, targs, kargs)) -import sys -try: - x = sys.exitfunc - - # if x isn't our own exit func executive, assume it's another - # registered exit function - append it to our list... - if x != _run_exitfuncs: - register(x) - -except AttributeError: - pass - -# make our exit function get run by python when it exits: -sys.exitfunc = _run_exitfuncs - -del sys +# make our exit function get run by python when it exits +atexit.register(_run_exitfuncs) # Local Variables: # tab-width:4 |
