mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fuck. For PC support, this must be in the distribution.
This commit is contained in:
parent
ad8b3baa91
commit
5c971677a5
84 changed files with 13110 additions and 0 deletions
23
Lib/dos-8x3/test_sel.py
Executable file
23
Lib/dos-8x3/test_sel.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
# Testing select module
|
||||
|
||||
def test():
|
||||
import select
|
||||
import os
|
||||
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do date; sleep 3; done'
|
||||
p = os.popen(cmd, 'r')
|
||||
for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
|
||||
print 'timeout =', tout
|
||||
rfd, wfd, xfd = select.select([p], [], [], tout)
|
||||
print rfd, wfd, xfd
|
||||
if (rfd, wfd, xfd) == ([], [], []):
|
||||
continue
|
||||
if (rfd, wfd, xfd) == ([p], [], []):
|
||||
line = p.readline()
|
||||
print `line`
|
||||
if not line:
|
||||
print 'EOF'
|
||||
break
|
||||
continue
|
||||
print 'Heh?'
|
||||
|
||||
test()
|
Loading…
Add table
Add a link
Reference in a new issue