diff options
author | David Lord <davidism@gmail.com> | 2020-10-14 10:38:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 10:38:42 -0700 |
commit | 84f39d90c7b22abbedb5f10a5cdf424a4ad22aaa (patch) | |
tree | 851df94bd7c17143bac07e0ec02996b616c7da92 | |
parent | 3d9e5a6882d2295d1275081289cdd9cac66ee113 (diff) | |
parent | 6b0230676b786913034e8d7319100e06333d43be (diff) | |
download | werkzeug-84f39d90c7b22abbedb5f10a5cdf424a4ad22aaa.tar.gz |
Merge pull request #1915 from Carreau/patch-1
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | src/werkzeug/_reloader.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 6cf8b75c..27cb4977 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -59,6 +59,8 @@ Unreleased - Update the defaults used by ``generat_password_hash``. Increase PBKDF2 iterations to 260000 from 150000. Increase salt length to 16 from 8. Use ``secrets`` module to generate salt. :pr:`1935` +- The reloader doesn't crash if ``sys.stdin`` is somehow ``None``. + :pr:`1915` Version 1.0.2 diff --git a/src/werkzeug/_reloader.py b/src/werkzeug/_reloader.py index 43326769..3d3ff942 100644 --- a/src/werkzeug/_reloader.py +++ b/src/werkzeug/_reloader.py @@ -306,13 +306,16 @@ def ensure_echo_on(): """Ensure that echo mode is enabled. Some tools such as PDB disable it which causes usability issues after a reload.""" # tcgetattr will fail if stdin isn't a tty - if not sys.stdin.isatty(): + if sys.stdin is None or not sys.stdin.isatty(): return + try: import termios except ImportError: return + attributes = termios.tcgetattr(sys.stdin) + if not attributes[3] & termios.ECHO: attributes[3] |= termios.ECHO termios.tcsetattr(sys.stdin, termios.TCSANOW, attributes) |