Commit 1ae515f6 authored by Denis Bilenko's avatar Denis Bilenko

add test__issue6.py

parent 8ae0f004
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('hello world\n')
code = p.poll()
assert p.poll() == 0, (out, err, code)
assert out.strip() == '11 chars.', (out, err, code)
assert err == '', (out, err, code)
elif sys.argv[1:] == ['subprocess']:
import gevent
import gevent.monkey
gevent.monkey.patch_all(sys=True)
def printline():
line = raw_input()
print '%s chars.' % len(line)
gevent.spawn(printline).join()
else:
sys.exit('Invalid arguments: %r' % (sys.argv, ))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment