Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't detect executable file for reloader #1613

Merged
merged 1 commit into from Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
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
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