David Glick
2015-02-13 c45d6aea833245fa4fd9bb81352feb37045dfb07
Add workaround to make sure echo is enabled after reload (refs #689)

Also add myself to CONTRIBUTORS.txt
3 files modified
19 ■■■■■ changed files
CHANGES.txt 3 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.txt 2 ●●●●● patch | view | raw | blame | history
pyramid/scripts/pserve.py 14 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -88,6 +88,9 @@
Bug Fixes
---------
- Work around an issue where ``pserve --reload`` would leave terminal echo
  disabled if it reloaded during a pdb session.
- ``pyramid.wsgi.wsgiapp`` and ``pyramid.wsgi.wsgiapp2`` now raise
  ``ValueError`` when accidentally passed ``None``.
  See https://github.com/Pylons/pyramid/pull/1320
CONTRIBUTORS.txt
@@ -242,3 +242,5 @@
- Ilja Everila, 2015/02/05
- Geoffrey T. Dairiki, 2015/02/06
- David Glick, 2015/02/12
pyramid/scripts/pserve.py
@@ -36,6 +36,11 @@
MAXFD = 1024
try:
    import termios
except ImportError: # pragma: no cover
    termios = None
if WIN and not hasattr(os, 'kill'): # pragma: no cover
    # py 2.6 on windows
    def kill(pid, sig=None):
@@ -709,6 +714,14 @@
        raise SystemExit
    signal.signal(signal.SIGTERM, handle_term)
def ensure_echo_on(): # pragma: no cover
    if termios:
        fd = sys.stdin.fileno()
        attr_list = termios.tcgetattr(fd)
        if not attr_list[3] & termios.ECHO:
            attr_list[3] |= termios.ECHO
            termios.tcsetattr(fd, termios.TCSANOW, attr_list)
def install_reloader(poll_interval=1, extra_files=None): # pragma: no cover
    """
    Install the reloading monitor.
@@ -718,6 +731,7 @@
    ``raise_keyboard_interrupt`` option creates a unignorable signal
    which causes the whole application to shut-down (rudely).
    """
    ensure_echo_on()
    mon = Monitor(poll_interval=poll_interval)
    if extra_files is None:
        extra_files = []