[dpdk-web] [PATCH 3/3] local: open in a browser

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Feb 10 11:17:59 CET 2016


As this mailing-list needs some animation, I reply to myself:

2016-02-10 11:05, Thomas Monjalon:
> When starting the local server the URL is printed and automatically open
> in the default browser.
> A delay is introduced to wait server initialization and avoid an error
> page in the browser.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
[...]
> +def open_browser():
> +    subprocess.call(["xdg-open", url])
> +
> +url = "http://localhost:%d" % port
> +print(url)
> +threading.Timer(1, open_browser).start()

I don't like opening a client in the server script.
I would prefer to put it in the Makefile:

 local:
+       (sleep 1 && xdg-open http://localhost:8000) &
        $(PYTHON2) scripts/serve_local.py



More information about the web mailing list