blob: 89088ef6284a404e1bec0f8477068b17d210d4e2 [file] [log] [blame]
Guido van Rossumb31c7f71993-11-11 10:31:23 +00001# Testing select module
2
3from test_support import *
4
5def test():
6 import select
7 import os
8 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do date; sleep 3; done'
9 p = os.popen(cmd, 'r')
10 for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
11 print 'timeout =', tout
12 rfd, wfd, xfd = select.select([p], [], [], tout)
13 print rfd, wfd, xfd
14 if (rfd, wfd, xfd) == ([], [], []):
15 continue
16 if (rfd, wfd, xfd) == ([p], [], []):
17 line = p.readline()
18 print `line`
19 if not line:
20 print 'EOF'
21 break
22 continue
23 print 'Heh?'
24
25test()