mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Close event loop to avoid error on exiting HASS (#3762)
This commit is contained in:
committed by
Johann Kellerman
parent
09cbf68637
commit
fe317b806f
@@ -159,11 +159,13 @@ class HomeAssistant(object):
|
||||
# Register the async start
|
||||
self.loop.create_task(self.async_start())
|
||||
|
||||
@callback
|
||||
def stop_homeassistant(*args):
|
||||
"""Stop Home Assistant."""
|
||||
self.exit_code = 0
|
||||
self.async_add_job(self.async_stop)
|
||||
|
||||
@callback
|
||||
def restart_homeassistant(*args):
|
||||
"""Restart Home Assistant."""
|
||||
self.exit_code = RESTART_EXIT_CODE
|
||||
@@ -205,6 +207,8 @@ class HomeAssistant(object):
|
||||
except KeyboardInterrupt:
|
||||
self.loop.call_soon(stop_homeassistant)
|
||||
self.loop.run_forever()
|
||||
finally:
|
||||
self.loop.close()
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_start(self):
|
||||
|
||||
Reference in New Issue
Block a user