Skip to content

Commit

Permalink
Fork off webbrowser call in case it fails to return
Browse files Browse the repository at this point in the history
calls to webbrowser.open do not return for command-line browser, so run it in a fork
  • Loading branch information
ChrisJefferson authored Mar 31, 2021
1 parent 8cc31e0 commit eb9ffa3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nikola/plugins/command/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb9ffa3

Please sign in to comment.