Skip to content
Browse files

turns out to be nice to use ginkgoctl on services running in the fore…

…ground with ginkgo, so we'll always create a pidfile unless explicitly set to False
  • Loading branch information...
1 parent 41ab7b5 commit 0aab84a603184e5c357057ab23524719b2483085 @progrium committed Apr 28, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 ginkgo/runner.py
View
8 ginkgo/runner.py
@@ -210,7 +210,7 @@ def __init__(self, app_factory, config=None):
self.config = config or ginkgo.settings
self.logger = ginkgo.logger.Logger(self)
- if self.daemon:
+ if self.pidfile is not False:
if self.pidfile is None:
self.config.set("pidfile",
"/tmp/{}.pid".format(self.service_name))
@@ -241,9 +241,11 @@ def do_start(self):
ginkgo.util.prevent_core_dump()
ginkgo.util.daemonize(
preserve_fds=self.logger.file_descriptors)
+ self.logger.capture_stdio()
self.pid = os.getpid()
+
+ if self.pidfile:
self.pidfile.create(self.pid)
- self.logger.capture_stdio()
if self.umask is not None:
os.umask(self.umask)
@@ -278,7 +280,7 @@ def post_start(self):
def do_stop(self):
logger.info("Stopping.")
self.logger.shutdown()
- if self.daemon:
+ if self.pidfile:
self.pidfile.unlink()
def do_reload(self):

0 comments on commit 0aab84a

Please sign in to comment.
Something went wrong with that request. Please try again.