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.pull/1012/head
parent
a41b66bb94
commit
b56369855a
homeassistant
|
@ -251,7 +251,7 @@ def run_hass_process(hass_proc):
|
|||
try:
|
||||
signal.signal(signal.SIGTERM, request_stop)
|
||||
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()
|
||||
try:
|
||||
|
@ -262,7 +262,7 @@ def run_hass_process(hass_proc):
|
|||
hass_proc.join()
|
||||
except KeyboardInterrupt:
|
||||
return False
|
||||
return not requested_stop.isSet() and hass_proc.exitcode > 0
|
||||
return not requested_stop.isSet() and hass_proc.exitcode == 100
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -294,7 +294,7 @@ def main():
|
|||
if 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
|
||||
while keep_running:
|
||||
hass_proc = Process(target=setup_and_run_hass, args=(config_dir, args))
|
||||
|
|
Loading…
Reference in New Issue