[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Zope2.Startup.zopectl: fork before execv when running unit tests

Tres Seaver tseaver at palladion.com
Thu Aug 4 11:49:08 EDT 2005


Log message for revision 37701:
  Zope2.Startup.zopectl: fork before execv when running unit tests
  
  Avoids exiting the zopectl shell, if run from there.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/Zope2/Startup/zopectl.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-08-04 15:35:29 UTC (rev 37700)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-08-04 15:49:07 UTC (rev 37701)
@@ -26,6 +26,9 @@
 
     Bugs Fixed
 
+      - Zope2.Startup.zopectl: fork before execv when running unit tests
+        (don't exit the shell, if run from there).
+
       - TAL: MassageIDs are now handled the same way as in zope.tal.
 
       - DocumentTemplate: ustr no longer mangles MassageIDs.

Modified: Zope/branches/Zope-2_8-branch/lib/python/Zope2/Startup/zopectl.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Zope2/Startup/zopectl.py	2005-08-04 15:35:29 UTC (rev 37700)
+++ Zope/branches/Zope-2_8-branch/lib/python/Zope2/Startup/zopectl.py	2005-08-04 15:49:07 UTC (rev 37701)
@@ -259,7 +259,11 @@
         args.insert(0, self.options.python)
 
         print 'Running tests via: %s' % ' '.join(args)
-        os.execv(self.options.python, args)
+        pid = os.fork()
+        if pid == 0:  # child
+            os.execv(self.options.python, args)
+        else:
+            os.waitpid(pid, 0)
 
     def help_test(self):
         print "test [args]+ -- run unit / functional tests."



More information about the Zope-Checkins mailing list