Move windows restart handler out of setup_and_run_hass
This commit is contained in:
parent
b2604b6f8e
commit
6ecd00ceec
1 changed files with 13 additions and 13 deletions
|
@ -248,19 +248,6 @@ async def setup_and_run_hass(config_dir: str,
|
||||||
"""Set up HASS and run."""
|
"""Set up HASS and run."""
|
||||||
from homeassistant import bootstrap, core
|
from homeassistant import bootstrap, core
|
||||||
|
|
||||||
# Run a simple daemon runner process on Windows to handle restarts
|
|
||||||
if os.name == 'nt' and '--runner' not in sys.argv:
|
|
||||||
nt_args = cmdline() + ['--runner']
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
subprocess.check_call(nt_args)
|
|
||||||
sys.exit(0)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
sys.exit(0)
|
|
||||||
except subprocess.CalledProcessError as exc:
|
|
||||||
if exc.returncode != RESTART_EXIT_CODE:
|
|
||||||
sys.exit(exc.returncode)
|
|
||||||
|
|
||||||
hass = core.HomeAssistant()
|
hass = core.HomeAssistant()
|
||||||
|
|
||||||
if args.demo_mode:
|
if args.demo_mode:
|
||||||
|
@ -353,6 +340,19 @@ def main() -> int:
|
||||||
|
|
||||||
set_loop()
|
set_loop()
|
||||||
|
|
||||||
|
# Run a simple daemon runner process on Windows to handle restarts
|
||||||
|
if os.name == 'nt' and '--runner' not in sys.argv:
|
||||||
|
nt_args = cmdline() + ['--runner']
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
subprocess.check_call(nt_args)
|
||||||
|
sys.exit(0)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit(0)
|
||||||
|
except subprocess.CalledProcessError as exc:
|
||||||
|
if exc.returncode != RESTART_EXIT_CODE:
|
||||||
|
sys.exit(exc.returncode)
|
||||||
|
|
||||||
args = get_arguments()
|
args = get_arguments()
|
||||||
|
|
||||||
if args.script is not None:
|
if args.script is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue