Skip to content

Commit 05203d7

Browse files
committedJul 26, 2015
fix #1913 -- graceful serve -d fallback
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent 92d810f commit 05203d7

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed
 

Diff for: ‎CHANGES.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ Features
1212
Bugfixes
1313
--------
1414

15-
* Don't auto-rebuild on changes to ".foo" or "foo~" or changes in folders.
15+
* Graceful fallback in ``nikola serve --detach`` on Windows (Issue #1913)
16+
* Don't auto-rebuild on changes to ".foo" or "foo~" or changes in folders
1617
* auto should also rebuild in response to move events
1718
* Don’t get metadata from file if compiler-specific metadata exist (Issue #1904)
1819
* Fix PRETTY_URLS prompt for Windows (Issue #1901)
1920
* Fix reST and Markdown title extraction from documents (Issue #1895, #1898)
20-
* Minor improvements in the extending document.
21+
* Minor improvements to the extending document
2122
* Re-add the hack to kill nikola auto on ^C (Issue #1893)
2223

2324
New in v7.6.1

Diff for: ‎nikola/plugins/command/serve.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,17 @@ def _execute(self, options, args):
127127
webbrowser.open(server_url)
128128
if options['detach']:
129129
OurHTTPRequestHandler.quiet = True
130-
pid = os.fork()
131-
if pid == 0:
132-
httpd.serve_forever()
133-
else:
134-
self.logger.info("Detached with PID {0}. Run `kill {0}` to stop the server.".format(pid))
130+
try:
131+
pid = os.fork()
132+
if pid == 0:
133+
httpd.serve_forever()
134+
else:
135+
self.logger.info("Detached with PID {0}. Run `kill {0}` to stop the server.".format(pid))
136+
except AttributeError as e:
137+
if os.name == 'nt':
138+
self.logger.warning("Detaching is not available on Windows, server is running in the foreground.")
139+
else:
140+
raise e
135141
else:
136142
try:
137143
httpd.serve_forever()

0 commit comments

Comments
 (0)
Please sign in to comment.