Server IP : 85.214.239.14 / Your IP : 3.144.104.175 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/lib64/python3.5/site-packages/gevent/tests/ |
Upload File : |
from __future__ import print_function import sys if not sys.argv[1:]: from subprocess import Popen, PIPE p = Popen([sys.executable, __file__, 'subprocess'], stdin=PIPE, stdout=PIPE, stderr=PIPE) out, err = p.communicate(b'hello world\n') code = p.poll() assert p.poll() == 0, (out, err, code) assert out.strip() == b'11 chars.', (out, err, code) # XXX: This is seen sometimes to fail on Travis with the following value in err but a code of 0; # it seems load related: # 'Unhandled exception in thread started by \nsys.excepthook is missing\nlost sys.stderr\n'. # If warnings are enabled, Python 3 has started producing this: # '...importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ # or __package__, falling back on __name__ and __path__\n return f(*args, **kwds)\n' assert err == b'' or b'sys.excepthook' in err or b'Warning' in err, (out, err, code) elif sys.argv[1:] == ['subprocess']: # pragma: no cover import gevent import gevent.monkey gevent.monkey.patch_all(sys=True) def printline(): try: line = raw_input() except NameError: line = input() print('%s chars.' % len(line)) gevent.spawn(printline).join() else: # pragma: no cover sys.exit('Invalid arguments: %r' % (sys.argv, ))