From 6a1f9902f1679a9757e200b2c4cb3fa922af0679 Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 16 Sep 2013 15:58:03 +0200 Subject: Made gifterm exit silently when a KeyboardInterrupt occurs --- pixelterm/gifterm.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pixelterm') diff --git a/pixelterm/gifterm.py b/pixelterm/gifterm.py index 67ee99f..85c0428 100755 --- a/pixelterm/gifterm.py +++ b/pixelterm/gifterm.py @@ -43,11 +43,14 @@ def main(): atexit.register(lambda:print(cursor_visible)) signal.signal(signal.SIGTERM, lambda signum, stack_frame: exit(1)) - while True: - for frame in frames: - print(clear_screen, pixelterm.reset_sequence) - print(frame) - time.sleep(img.info['duration']/1000.0) + try: + while True: + for frame in frames: + print(clear_screen, pixelterm.reset_sequence) + print(frame) + time.sleep(img.info['duration']/1000.0) + except KeyboardInterrupt: + pass if __name__ == '__main__': main() -- cgit