Refactor
Make sure we have a tty before using stty