Skip to content

Commit eb9ffa3

Browse files
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
1 parent 8cc31e0 commit eb9ffa3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nikola/plugins/command/serve.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ def _execute(self, options, args):
141141
if sa[0] == '0.0.0.0':
142142
server_url = "http://127.0.0.1:{1}/".format(*sa)
143143
self.logger.info("Opening {0} in the default web browser...".format(server_url))
144-
webbrowser.open(server_url)
144+
pid = os.fork()
145+
if pid == 0:
146+
webbrowser.open(server_url)
147+
sys.exit(0)
145148
if options['detach']:
146149
self.detached = True
147150
OurHTTPRequestHandler.quiet = True

0 commit comments

Comments
 (0)