Skip to content

Commit

Permalink
Merge pull request #1613 from pallets/revert-nixos-reloader-check
Browse files Browse the repository at this point in the history
don't detect executable file for reloader
  • Loading branch information
davidism authored Jul 15, 2019
2 parents a8d26bf + 1f532b8 commit 726b25b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
12 changes: 2 additions & 10 deletions src/werkzeug/_reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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".
Expand Down

0 comments on commit 726b25b

Please sign in to comment.