summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyramid/scripts/pserve.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index 1bfedf384..63f34f6c2 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -302,7 +302,10 @@ class PServeCommand(object):
raise ValueError(msg)
writeable_pid_file.close()
- if getattr(self.options, 'daemon', False):
+ if (
+ getattr(self.options, 'daemon', False) and
+ not os.environ.get(self._monitor_environ_key)
+ ):
self._warn_daemon_deprecated()
try:
self.daemonize()
@@ -312,14 +315,17 @@ class PServeCommand(object):
return 2
if (
+ not os.environ.get(self._monitor_environ_key) and
+ self.options.pid_file
+ ):
+ self.record_pid(self.options.pid_file)
+
+ if (
self.options.monitor_restart and
not os.environ.get(self._monitor_environ_key)
):
return self.restart_with_monitor()
- if self.options.pid_file:
- self.record_pid(self.options.pid_file)
-
if self.options.log_file:
stdout_log = LazyWriter(self.options.log_file, 'a')
sys.stdout = stdout_log