fix bug where onionr would complain while restarting about not being able to start
This commit is contained in:
parent
c5fd39c762
commit
b878faeb4c
@ -36,3 +36,5 @@ onboarding_mark_file = home + 'onboarding-completed'
|
|||||||
log_file = home + 'onionr.log'
|
log_file = home + 'onionr.log'
|
||||||
|
|
||||||
ephemeral_services_file = home + 'ephemeral-services.list'
|
ephemeral_services_file = home + 'ephemeral-services.list'
|
||||||
|
|
||||||
|
restarting_indicator = home + "is-restarting"
|
||||||
|
@ -214,6 +214,13 @@ def start(override: bool = False):
|
|||||||
Error exit if there is and its not overridden
|
Error exit if there is and its not overridden
|
||||||
"""
|
"""
|
||||||
if os.path.exists(filepaths.lock_file) and not override:
|
if os.path.exists(filepaths.lock_file) and not override:
|
||||||
|
if os.path.exists(filepaths.restarting_indicator):
|
||||||
|
try:
|
||||||
|
os.remove(filepaths.restarting_indicator)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return
|
||||||
logger.fatal('Cannot start. Daemon is already running,'
|
logger.fatal('Cannot start. Daemon is already running,'
|
||||||
+ ' or it did not exit cleanly.\n'
|
+ ' or it did not exit cleanly.\n'
|
||||||
+ ' (if you are sure that there is not a daemon running,'
|
+ ' (if you are sure that there is not a daemon running,'
|
||||||
|
@ -49,7 +49,8 @@ def restart():
|
|||||||
return
|
return
|
||||||
except (AttributeError, OSError):
|
except (AttributeError, OSError):
|
||||||
logger.warn('Could not fork on restart')
|
logger.warn('Could not fork on restart')
|
||||||
|
with open(filepaths.restarting_indicator, 'w') as f:
|
||||||
|
f.write('t')
|
||||||
daemonlaunch.kill_daemon()
|
daemonlaunch.kill_daemon()
|
||||||
while localcommand.local_command('ping', maxWait=8) == 'pong!':
|
while localcommand.local_command('ping', maxWait=8) == 'pong!':
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
Loading…
Reference in New Issue
Block a user