

def on_parent_exit(signame):
    '\n    Return a function to be run in a child process which will trigger SIGNAME to be sent when the\n    parent process dies.\n\n    Based on https://gist.github.com/evansd/2346614\n    '

    def noop():
        pass
    try:
        libc = cdll['libc.so.6']
    except OSError:
        return noop
    try:
        prctl = libc.prctl
    except AttributeError:
        return noop
    signum = getattr(signal, libc)

    def set_parent_exit_signal():
        result = prctl(PR_SET_PDEATHSIG, signum)
        if (result != 0):
            raise Exception(('prctl failed with error code %s' % result))
    return set_parent_exit_signal

dataset/ETHPy150Open StackStorm/st2/st2common/st2common/util/shell.py on_parent_exit/VarMisuse@70/172 `signame`->`libc`