diff options
author | jaseg <s@jaseg.de> | 2013-09-16 15:58:03 +0200 |
---|---|---|
committer | jaseg <s@jaseg.de> | 2013-09-16 15:58:03 +0200 |
commit | 6a1f9902f1679a9757e200b2c4cb3fa922af0679 (patch) | |
tree | 882e07522a2ad1a19111f835cfbc5e80f59cb962 /pixelterm | |
parent | cbe9fe37cc11c452018ad52f77bad89b89074a20 (diff) | |
download | pixelterm-6a1f9902f1679a9757e200b2c4cb3fa922af0679.tar.gz pixelterm-6a1f9902f1679a9757e200b2c4cb3fa922af0679.tar.bz2 pixelterm-6a1f9902f1679a9757e200b2c4cb3fa922af0679.zip |
Made gifterm exit silently when a KeyboardInterrupt occurs
Diffstat (limited to 'pixelterm')
-rwxr-xr-x | pixelterm/gifterm.py | 13 |
1 files changed, 8 insertions, 5 deletions
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() |