| | |
| | | |
| | | 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): |
| | |
| | | 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. |
| | |
| | | ``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 = [] |