From d9f7eddd63ff8b8ec6de3498bd33b234af0a92e5 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 12 Nov 2015 22:52:29 -0600 Subject: fix usage of --monitor-restart with --daemon Fixes #1216 --- pyramid/scripts/pserve.py | 14 ++++++++++---- 1 file 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() @@ -311,15 +314,18 @@ class PServeCommand(object): self.out(str(ex)) 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 -- cgit v1.2.3 From 389b450da27a91fb413a5eab5ed4a704537ac105 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 12 Nov 2015 22:58:46 -0600 Subject: add changelog entry for #2118 --- CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 8b63cf847..77b8e9298 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -232,6 +232,9 @@ Bug Fixes shell a little more straightfoward. See https://github.com/Pylons/pyramid/pull/1883 +- Fixed usage of ``pserve --monitor-restart --daemon`` which would fail in + horrible ways. See https://github.com/Pylons/pyramid/pull/2118 + Deprecations ------------ -- cgit v1.2.3