Skip to content

Commit

Permalink
fix #1913 -- graceful serve -d fallback
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 26, 2015
1 parent 92d810f commit 05203d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions CHANGES.txt
Expand Up @@ -12,12 +12,13 @@ Features
Bugfixes
--------

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

New in v7.6.1
Expand Down
16 changes: 11 additions & 5 deletions nikola/plugins/command/serve.py
Expand Up @@ -127,11 +127,17 @@ def _execute(self, options, args):
webbrowser.open(server_url)
if options['detach']:
OurHTTPRequestHandler.quiet = True
pid = os.fork()
if pid == 0:
httpd.serve_forever()
else:
self.logger.info("Detached with PID {0}. Run `kill {0}` to stop the server.".format(pid))
try:
pid = os.fork()
if pid == 0:
httpd.serve_forever()
else:
self.logger.info("Detached with PID {0}. Run `kill {0}` to stop the server.".format(pid))
except AttributeError as e:
if os.name == 'nt':
self.logger.warning("Detaching is not available on Windows, server is running in the foreground.")
else:
raise e
else:
try:
httpd.serve_forever()
Expand Down

0 comments on commit 05203d7

Please sign in to comment.