| | 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) |
|---|