From 36ed11d2e59fbdc0bf9537be955b92aeb942e5cd Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Thu, 1 Nov 2018 19:12:19 -0400 Subject: [PATCH] Remove preexec_fn hack from test cluster management The hack is ugly, and the correct shutdown of the launched cluster is alreadye handled by the atexit hook installed by the test harness. --- asyncpg/cluster.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/asyncpg/cluster.py b/asyncpg/cluster.py index b6f17651..13d79557 100644 --- a/asyncpg/cluster.py +++ b/asyncpg/cluster.py @@ -36,21 +36,6 @@ def platform_exe(name): return name -if _system == 'Linux': - def ensure_dead_with_parent(): - import ctypes - import signal - - try: - PR_SET_PDEATHSIG = 1 - libc = ctypes.CDLL(ctypes.util.find_library('c')) - libc.prctl(PR_SET_PDEATHSIG, signal.SIGKILL) - except Exception as e: - print(e) -else: - ensure_dead_with_parent = None - - def find_available_port(port_range=(49152, 65535), max_tries=1000): low, high = port_range @@ -230,8 +215,7 @@ def start(self, wait=60, *, server_settings={}, **opts): self._daemon_process = \ subprocess.Popen( [self._postgres, '-D', self._data_dir, *extra_args], - stdout=stdout, stderr=subprocess.STDOUT, - preexec_fn=ensure_dead_with_parent) + stdout=stdout, stderr=subprocess.STDOUT) self._daemon_pid = self._daemon_process.pid