Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #581: macexecv.patch

  • cherrypy/_cpengine.py

    old new  
    112112         
    113113        if sys.platform == "win32": 
    114114            args = ['"%s"' % arg for arg in args] 
     115        elif sys.platform == "darwin": 
     116            # Can't call "execv" on darwin with more than one active thread 
     117            for thread in threading.enumerate(): 
     118                if thread == threading.currentThread() or not thread.isAlive(): 
     119                    continue 
     120                if hasattr(thread, 'cancel'): 
     121                    cherrypy.log("Quitting thread: %s" % thread, "ENGINE") 
     122                    thread.cancel() 
     123                    thread.join() 
     124                else: 
     125                    cherrypy.log("Can't quit thread: %s" % thread, "ENGINE") 
     126 
     127            try: 
     128                os.execv(sys.executable, args) 
     129            except: 
     130                cherrypy.log("Couldn't restart, retrying...", "ENGINE") 
     131                os.execv(sys.executable, args) 
    115132        os.execv(sys.executable, args) 
    116133     
    117134    def autoreload(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets