]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
autoreload: Improve autoreload wrapper on windows 2393/head
authorBen Darnell <ben@bendarnell.com>
Sun, 20 May 2018 03:28:45 +0000 (23:28 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 20 May 2018 03:36:39 +0000 (23:36 -0400)
On platforms without execv(), we must spawn a separate subprocess.
This breaks down when an internal autoreload is firing in a wrapped
process, since the internal reload raises an exception with the
wrapper catches (triggering a second reload and another copy of the
process).

tornado/autoreload.py

index 1c8bd88c85321852cd04edfb1fcc5831aa81f85f..7d69474a390ac2164749ab81ff0775007e39a007 100644 (file)
@@ -233,7 +233,7 @@ def _reload():
                                         os.environ.get("PYTHONPATH", ""))
     if not _has_execv:
         subprocess.Popen([sys.executable] + argv)
-        sys.exit(0)
+        os._exit(0)
     else:
         try:
             os.execv(sys.executable, [sys.executable] + argv)