[pypy-svn] r75377 - pypy/trunk/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Sun Jun 13 17:13:56 CEST 2010


Author: arigo
Date: Sun Jun 13 17:13:55 2010
New Revision: 75377

Modified:
   pypy/trunk/pypy/tool/runsubprocess.py
Log:
Clean-up explicitly.  Required on top of CPython to avoid
suspitious errors at process exit.


Modified: pypy/trunk/pypy/tool/runsubprocess.py
==============================================================================
--- pypy/trunk/pypy/tool/runsubprocess.py	(original)
+++ pypy/trunk/pypy/tool/runsubprocess.py	Sun Jun 13 17:13:55 2010
@@ -27,7 +27,9 @@
 
 
 if __name__ == '__main__':
+    import gc
     while True:
+        gc.collect()
         operation = sys.stdin.readline()
         if not operation:
             sys.exit()
@@ -52,6 +54,11 @@
                        stdin=PIPE, stdout=PIPE, close_fds=True)
     spawn_subprocess()
 
+    def cleanup_subprocess():
+        global _child
+        _child = None
+    import atexit; atexit.register(cleanup_subprocess)
+
     def _run(*args):
         try:
             _child.stdin.write('%r\n' % (args,))



More information about the Pypy-commit mailing list