From e7caac212d183c8478851e99bb96d707f961008f Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Tue, 1 Sep 2015 04:03:51 -0400 Subject: [PATCH] Fixed signal binding exception Cleanly handle error for failed SIGQUIT binding. This can happen when running in a thread. --- homeassistant/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index 1e48fce8029..4a20bfc5002 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -82,7 +82,11 @@ class HomeAssistant(object): DOMAIN, SERVICE_HOMEASSISTANT_STOP, stop_homeassistant) if os.name != "nt": - signal.signal(signal.SIGQUIT, stop_homeassistant) + try: + signal.signal(signal.SIGQUIT, stop_homeassistant) + except ValueError: + _LOGGER.warning( + 'Could not bind to SIGQUIT. Are you running in a thread?') while not request_shutdown.isSet(): try: