Skip to content

Commit 018a05c

Browse files
Print message instead of opening command line browser
If the browser is www-browser, opening it will pause Python, which stops Nikola serving pages.
1 parent 8cc31e0 commit 018a05c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nikola/plugins/command/serve.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,11 @@ def _execute(self, options, args):
140140
# Some browsers fail to load 0.0.0.0 (Issue #2755)
141141
if sa[0] == '0.0.0.0':
142142
server_url = "http://127.0.0.1:{1}/".format(*sa)
143-
self.logger.info("Opening {0} in the default web browser...".format(server_url))
144-
webbrowser.open(server_url)
143+
if getattr(webbrowser.get(), "name", "") == "www-browser":
144+
self.logger.info("Unable to open web browser, as Python could only find a terminal browser...")
145+
else:
146+
self.logger.info("Opening {0} in the default web browser...".format(server_url))
147+
webbrowser.open(server_url)
145148
if options['detach']:
146149
self.detached = True
147150
OurHTTPRequestHandler.quiet = True

0 commit comments

Comments
 (0)