From: Ben Darnell Date: Sun, 20 May 2018 03:28:45 +0000 (-0400) Subject: autoreload: Improve autoreload wrapper on windows X-Git-Tag: v5.1.0b1~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feee98fc1293f8a5a006ce7556c8f76a6081dbce;p=thirdparty%2Ftornado.git autoreload: Improve autoreload wrapper on windows 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). --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index 1c8bd88c8..7d69474a3 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -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)