Create new session and set the process group ID for the postmaster

Otherwice it was receiving signal when you pressed Ctrl+C in the
terminal where patroni is running.
This commit is contained in:
Alexander Kukushkin
2016-02-10 14:51:20 +01:00
parent 50512fef45
commit 7b524bc557
+1 -1
View File
@@ -363,7 +363,7 @@ class Postgresql:
env = os.environ.copy()
if 'username' in self.superuser:
env['PGUSER'] = self.superuser['username']
ret = subprocess.call(self._pg_ctl + ['start', '-o', self.server_options()], env=env) == 0
ret = subprocess.call(self._pg_ctl + ['start', '-o', self.server_options()], env=env, preexec_fn=os.setsid) == 0
self.set_state('running' if ret else 'start failed')