Author: Antonio Cuni <[email protected]>
Branch: 
Changeset: r128:18e1209ed429
Date: 2011-06-10 15:09 +0200
http://bitbucket.org/pypy/jitviewer/changeset/18e1209ed429/

Log:    make sure that the server is always stopped

diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -211,17 +211,18 @@
         run_server_and_browser(app, run, url, filename)
 
 def run_server_and_browser(app, run, url, filename):
-    # start the HTTP server in another thread
-    th = threading.Thread(target=run)
-    th.start()
-    #
-    # start the webkit browser in the main thread (actually, it's a 
subprocess, but still)
-    time.sleep(0.5) # give the server some time to start
-    ret = start_browser(url, filename)
-    #
-    # shutdown the HTPP server and wait until it completes
-    app.servers[0].shutdown()
-    th.join()
+    try:
+        # start the HTTP server in another thread
+        th = threading.Thread(target=run)
+        th.start()
+        #
+        # start the webkit browser in the main thread (actually, it's a 
subprocess)
+        time.sleep(0.5) # give the server some time to start
+        ret = start_browser(url, filename)
+    finally:
+        # shutdown the HTPP server and wait until it completes
+        app.servers[0].shutdown()
+        th.join()
 
 def start_browser(url, filename):
     import subprocess
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to