mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Cleaned up restart handling in __main__.py
1. Fixed logged message about SIGTERM binding failure. 2. Set to only restart HASS with an exit code of 100. 3. Fixed typo in comment.
This commit is contained in:
parent
a41b66bb94
commit
b56369855a
@ -251,7 +251,7 @@ def run_hass_process(hass_proc):
|
|||||||
try:
|
try:
|
||||||
signal.signal(signal.SIGTERM, request_stop)
|
signal.signal(signal.SIGTERM, request_stop)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print('Could not bind to SIGQUIT. Are you running in a thread?')
|
print('Could not bind to SIGTERM. Are you running in a thread?')
|
||||||
|
|
||||||
hass_proc.start()
|
hass_proc.start()
|
||||||
try:
|
try:
|
||||||
@ -262,7 +262,7 @@ def run_hass_process(hass_proc):
|
|||||||
hass_proc.join()
|
hass_proc.join()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
return False
|
return False
|
||||||
return not requested_stop.isSet() and hass_proc.exitcode > 0
|
return not requested_stop.isSet() and hass_proc.exitcode == 100
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -294,7 +294,7 @@ def main():
|
|||||||
if args.pid_file:
|
if args.pid_file:
|
||||||
write_pid(args.pid_file)
|
write_pid(args.pid_file)
|
||||||
|
|
||||||
# Run hass is child process. Restart if necessary.
|
# Run hass as child process. Restart if necessary.
|
||||||
keep_running = True
|
keep_running = True
|
||||||
while keep_running:
|
while keep_running:
|
||||||
hass_proc = Process(target=setup_and_run_hass, args=(config_dir, args))
|
hass_proc = Process(target=setup_and_run_hass, args=(config_dir, args))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user