diff --git a/CHANGES.rst b/CHANGES.rst index 42bd46af0..23db01396 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,11 @@ Unreleased reloader to fail. :issue:`1607` - Work around an issue where the reloader couldn't introspect a setuptools script installed as an egg. :issue:`1600` +- The reloader will use ``sys.executable`` even if the script is + marked executable, reverting a behavior intended for NixOS + introduced in 0.15. The reloader should no longer cause + ``OSError: [Errno 8] Exec format error``. :issue:`1482`, + :issue:`1580` - ``SharedDataMiddleware`` safely handles paths with Windows drive names. :issue:`1589` diff --git a/src/werkzeug/_reloader.py b/src/werkzeug/_reloader.py index f085d44a2..b04432012 100644 --- a/src/werkzeug/_reloader.py +++ b/src/werkzeug/_reloader.py @@ -61,11 +61,8 @@ def _find_observable_paths(extra_files=None): def _get_args_for_reloading(): - """Returns the executable. This contains a workaround for windows - if the executable is incorrectly reported to not have the .exe - extension which can cause bugs on reloading. This also contains - a workaround for linux where the file is executable (possibly with - a program other than python) + """Determine how the script was executed, and return the args needed + to execute it again in a new process. """ rv = [sys.executable] py_script = sys.argv[0] @@ -91,11 +88,6 @@ def _get_args_for_reloading(): ): rv.pop(0) - elif os.path.isfile(py_script) and os.access(py_script, os.X_OK): - # The file is marked as executable. Nix adds a wrapper that - # shouldn't be called with the Python executable. - rv.pop(0) - rv.append(py_script) else: # Executed a module, like "python -m werkzeug.serving".