This commit is contained in:
clowwindy 2014-05-22 12:09:43 +08:00
parent 6e5a753d41
commit e113479a80

14
test.py
View file

@ -92,7 +92,8 @@ p3 = None
print 'encryption test passed'
try:
ready_count = 0
local_ready = False
server_ready = False
fdset = [p1.stdout, p2.stdout, p1.stderr, p2.stderr]
while True:
r, w, e = select.select(fdset, [], fdset)
@ -102,10 +103,13 @@ try:
for fd in r:
line = fd.readline()
sys.stdout.write(line)
if line.find('starting') >= 0:
ready_count += 1
if ready_count == 2 and p3 is None:
if line.find('starting local') >= 0:
local_ready = True
if line.find('starting server') >= 0:
server_ready = True
if local_ready and server_ready and p3 is None:
time.sleep(1)
p3 = Popen(['curl', 'http://www.example.com/', '-v', '-L',
'--socks5-hostname', '127.0.0.1:1080'], shell=False,
bufsize=0, close_fds=True)