Skip to content

Commit 36ed11d

Browse files
committed
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.
1 parent ffb9ebf commit 36ed11d

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

asyncpg/cluster.py

+1-17
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,6 @@ def platform_exe(name):
3636
return name
3737

3838

39-
if _system == 'Linux':
40-
def ensure_dead_with_parent():
41-
import ctypes
42-
import signal
43-
44-
try:
45-
PR_SET_PDEATHSIG = 1
46-
libc = ctypes.CDLL(ctypes.util.find_library('c'))
47-
libc.prctl(PR_SET_PDEATHSIG, signal.SIGKILL)
48-
except Exception as e:
49-
print(e)
50-
else:
51-
ensure_dead_with_parent = None
52-
53-
5439
def find_available_port(port_range=(49152, 65535), max_tries=1000):
5540
low, high = port_range
5641

@@ -230,8 +215,7 @@ def start(self, wait=60, *, server_settings={}, **opts):
230215
self._daemon_process = \
231216
subprocess.Popen(
232217
[self._postgres, '-D', self._data_dir, *extra_args],
233-
stdout=stdout, stderr=subprocess.STDOUT,
234-
preexec_fn=ensure_dead_with_parent)
218+
stdout=stdout, stderr=subprocess.STDOUT)
235219

236220
self._daemon_pid = self._daemon_process.pid
237221

0 commit comments

Comments
 (0)