From a001780afb70466fe4386c881ef46a4ccaea7d37 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sat, 6 Feb 2016 21:50:06 -0500 Subject: [PATCH] Fix Ctrl+C with Subprocesses Added KeyboardInterrupt handling back to block_till_stopped method. This is because Keyboard Interrupts are sent to both the parent and child process in no particular order so both need to handle the interrupt. --- homeassistant/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index c4dbd1562a5..b9bf49f261c 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -95,7 +95,10 @@ class HomeAssistant(object): 'Could not bind to SIGTERM. Are you running in a thread?') while not request_shutdown.isSet(): - time.sleep(1) + try: + time.sleep(1) + except KeyboardInterrupt: + break self.stop() return RESTART_EXIT_CODE if request_restart.isSet() else 0