'Routine executed in the child process before invoking execve().
Handles setting the controlling TTY as well as invoking the user-
supplied preexec_fn.'

def __preexec_fn(self):

    if (self.pty is not None):
        self.__pty_make_controlling_tty(self.pty)
    if (not self.aslr):
        try:
            if ((context.os == 'linux') and (self._setuid is not True)):
                ADDR_NO_RANDOMIZE = 262144
                ctypes.CDLL('libc.so.6').personality(ADDR_NO_RANDOMIZE)
            resource.setrlimit(resource.RLIMIT_STACK, ((-1), (-1)))
        except Exception:
            self.exception('Could    not    disable    ASLR')
    try:
        resource.setrlimit(resource.RLIMIT_CORE, ((-1), (-1)))
    except Exception:
        pass
    try:
        with open('/proc/self/coredump_filter', 'w') as f:
            f.write('0xff')
    except Exception:
        pass
    if (self._setuid is False):
        try:
            PR_SET_NO_NEW_PRIVS = 38
            ctypes.CDLL('libc.so.6').prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
        except Exception:
            pass
    try:
        PR_SET_PTRACER = 1499557217
        PR_SET_PTRACER_ANY = (-1)
        ctypes.CDLL('libc.so.6').prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0)
    except Exception:
        pass
    if (self.alarm is not None):
        signal.alarm(self.alarm)
    self.preexec_fn()
