Ticket #15565: restart.diff

File restart.diff, 811 bytes (added by Karen Tracey, 13 years ago)
  • django/utils/autoreload.py

     
    4242except ImportError:
    4343    pass
    4444
     45try:
     46    import termios
     47except ImportError:
     48    termios = None
    4549
    4650RUN_RELOADER = True
    4751
     
    6771            return True
    6872    return False
    6973
     74def ensure_echo_on():
     75    if termios:
     76        fd = sys.stdin.fileno()
     77        attr_list = termios.tcgetattr(fd)
     78        if not attr_list[3] & termios.ECHO:
     79            attr_list[3] |= termios.ECHO
     80            termios.tcsetattr(fd, termios.TCSANOW, attr_list)
     81
    7082def reloader_thread():
     83    ensure_echo_on()
    7184    while RUN_RELOADER:
    7285        if code_changed():
    7386            sys.exit(3) # force reload
Back to Top