mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 06:05:10 +02:00
add error handling
This commit is contained in:
@@ -167,15 +167,22 @@ class HomeAssistant(object):
|
||||
)
|
||||
|
||||
# Setup signal handling
|
||||
if sys.platform != "win32":
|
||||
self.loop.add_signal_handler(
|
||||
signal.SIGTERM,
|
||||
stop_homeassistant
|
||||
)
|
||||
self.loop.add_signal_handler(
|
||||
signal.SIGHUP,
|
||||
restart_homeassistant
|
||||
)
|
||||
if sys.platform != 'win32':
|
||||
try:
|
||||
self.loop.add_signal_handler(
|
||||
signal.SIGTERM,
|
||||
stop_homeassistant
|
||||
)
|
||||
except ValueError:
|
||||
_LOGGER.warning('Could not bind to SIGTERM.')
|
||||
|
||||
try:
|
||||
self.loop.add_signal_handler(
|
||||
signal.SIGHUP,
|
||||
restart_homeassistant
|
||||
)
|
||||
except ValueError:
|
||||
_LOGGER.warning('Could not bind to SIGHUP.')
|
||||
|
||||
# Run forever and catch keyboard interrupt
|
||||
try:
|
||||
|
Reference in New Issue
Block a user