diff --git a/spotify_ripper/main.py b/spotify_ripper/main.py index fd8a22d..c03c952 100644 --- a/spotify_ripper/main.py +++ b/spotify_ripper/main.py @@ -591,9 +591,12 @@ def check_uri_args(): # wait for ripping thread to finish if not args.has_log: - stdin_settings = termios.tcgetattr(sys.stdin) + try: + stdin_settings = termios.tcgetattr(sys.stdin) + except termios.error: + stdin_settings = None try: - if not args.has_log: + if not args.has_log and stdin_settings: tty.setcbreak(sys.stdin.fileno()) while ripper.isAlive(): @@ -611,7 +614,7 @@ def check_uri_args(): print("\n" + Fore.RED + "Aborting..." + Fore.RESET) abort() finally: - if not args.has_log: + if not args.has_log and stdin_settings: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, stdin_settings) if __name__ == '__main__':