keep browser process alive
This commit is contained in:
parent
c5876b1a0d
commit
09bb67d904
2 changed files with 6 additions and 5 deletions
|
@ -66,12 +66,13 @@ except:
|
||||||
if config.action == "main":
|
if config.action == "main":
|
||||||
from util import helper
|
from util import helper
|
||||||
try:
|
try:
|
||||||
lock = helper.openLocked("%s/lock.pid" % config.data_dir, "w")
|
lock = helper.openLocked(f"{config.data_dir}/lock.pid", "w")
|
||||||
lock.write("%s" % os.getpid())
|
lock.write(f"{os.getpid()}")
|
||||||
except BlockingIOError as err:
|
except BlockingIOError as err:
|
||||||
startupError(f"Can't open lock file, your 0net client is probably already running, exiting... ({err})")
|
startupError(f"Can't open lock file, your 0net client is probably already running, exiting... ({err})")
|
||||||
helper.openBrowser(config.open_browser)
|
proc = helper.openBrowser(config.open_browser)
|
||||||
sys.exit()
|
r = proc.wait()
|
||||||
|
sys.exit(r)
|
||||||
|
|
||||||
config.initLogging()
|
config.initLogging()
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,6 @@ def openBrowser(agent):
|
||||||
url = f'http://{ui_ip}:{config.ui_port}/{config.homepage}'
|
url = f'http://{ui_ip}:{config.ui_port}/{config.homepage}'
|
||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
subprocess.Popen([config.open_browser, url])
|
return subprocess.Popen([config.open_browser, url])
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(f"Error starting browser: {err}")
|
print(f"Error starting browser: {err}")
|
||||||
|
|
Loading…
Reference in a new issue