Skip to content

Commit 1f532b8

Browse files
committed
don't detect executable file for reloader
Reverts #1242 In order to support NixOS wrappers, the reloader would call an executable script directly. This caused issues with Windows, Docker, and other common development environments, resulting in an "Exec format error". Revert that change until a better workaround can be found.
1 parent a8d26bf commit 1f532b8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

CHANGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Unreleased
1919
reloader to fail. :issue:`1607`
2020
- Work around an issue where the reloader couldn't introspect a
2121
setuptools script installed as an egg. :issue:`1600`
22+
- The reloader will use ``sys.executable`` even if the script is
23+
marked executable, reverting a behavior intended for NixOS
24+
introduced in 0.15. The reloader should no longer cause
25+
``OSError: [Errno 8] Exec format error``. :issue:`1482`,
26+
:issue:`1580`
2227
- ``SharedDataMiddleware`` safely handles paths with Windows drive
2328
names. :issue:`1589`
2429

src/werkzeug/_reloader.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ def _find_observable_paths(extra_files=None):
6161

6262

6363
def _get_args_for_reloading():
64-
"""Returns the executable. This contains a workaround for windows
65-
if the executable is incorrectly reported to not have the .exe
66-
extension which can cause bugs on reloading. This also contains
67-
a workaround for linux where the file is executable (possibly with
68-
a program other than python)
64+
"""Determine how the script was executed, and return the args needed
65+
to execute it again in a new process.
6966
"""
7067
rv = [sys.executable]
7168
py_script = sys.argv[0]
@@ -91,11 +88,6 @@ def _get_args_for_reloading():
9188
):
9289
rv.pop(0)
9390

94-
elif os.path.isfile(py_script) and os.access(py_script, os.X_OK):
95-
# The file is marked as executable. Nix adds a wrapper that
96-
# shouldn't be called with the Python executable.
97-
rv.pop(0)
98-
9991
rv.append(py_script)
10092
else:
10193
# Executed a module, like "python -m werkzeug.serving".

0 commit comments

Comments
 (0)