fix bugs in daemonization logic

This commit is contained in:
Jude Nelson
2017-02-25 00:40:39 -05:00
parent 25cd1052f3
commit 05736acc36
2 changed files with 26 additions and 10 deletions

View File

@@ -3519,11 +3519,16 @@ def local_api_start( port=None, config_dir=blockstack_constants.CONFIG_DIR, fore
logpath = local_api_logfile_path(config_dir=config_dir)
res = daemonize(logpath, child_wait=lambda: local_api_start_wait(config_path=config_path))
if not res:
if res < 0:
log.error("API server failed to start")
return False
# daemon now...
if res > 0:
# parent
log.debug("Parent {} forked intermediate child {}".format(os.getpid(), res))
return True
# daemon child takes this path...
atexit.register(local_api_atexit)
# load up internal RPC methods