From 34b162877ea16b547ac01c984664f4e42b020400 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 29 Oct 2012 10:43:03 +0100 Subject: [PATCH] Allow shutting down using KeyboardInterrupt --- Headphones.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Headphones.py b/Headphones.py index 18bb7970..2843e076 100644 --- a/Headphones.py +++ b/Headphones.py @@ -140,7 +140,10 @@ def main(): while True: if not headphones.SIGNAL: - time.sleep(1) + try: + time.sleep(1) + except KeyboardInterrupt: + headphones.SIGNAL = 'shutdown' else: logger.info('Received signal: ' + headphones.SIGNAL) if headphones.SIGNAL == 'shutdown':