Skip to content

Commit

Permalink
Remove preexec_fn hack from test cluster management
Browse files Browse the repository at this point in the history
The hack is ugly, and the correct shutdown of the launched cluster
is alreadye handled by the atexit hook installed by the test harness.
  • Loading branch information
elprans committed Nov 1, 2018
1 parent ffb9ebf commit 36ed11d
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions asyncpg/cluster.py
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 36ed11d

Please sign in to comment.