From eb9ffa395afd1a5e2ccd0028a8d5297a460d8e6f Mon Sep 17 00:00:00 2001 From: Christopher Jefferson Date: Wed, 31 Mar 2021 18:39:38 +0100 Subject: [PATCH] Fork off webbrowser call in case it fails to return calls to webbrowser.open do not return for command-line browser, so run it in a fork --- nikola/plugins/command/serve.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nikola/plugins/command/serve.py b/nikola/plugins/command/serve.py index 06c7422df4..5b110cbf38 100644 --- a/nikola/plugins/command/serve.py +++ b/nikola/plugins/command/serve.py @@ -141,7 +141,10 @@ def _execute(self, options, args): if sa[0] == '0.0.0.0': server_url = "http://127.0.0.1:{1}/".format(*sa) self.logger.info("Opening {0} in the default web browser...".format(server_url)) - webbrowser.open(server_url) + pid = os.fork() + if pid == 0: + webbrowser.open(server_url) + sys.exit(0) if options['detach']: self.detached = True OurHTTPRequestHandler.quiet = True