¡@

Home 

python Programming Glossary: master_fd

Python subprocess readlines() hangs

http://stackoverflow.com/questions/12419198/python-subprocess-readlines-hangs

pty import select from subprocess import Popen STDOUT master_fd slave_fd pty.openpty # provide tty to enable # line buffering.. True timeout .04 # seconds while 1 ready _ _ select.select master_fd timeout if ready data os.read master_fd 512 if not data break.. _ _ select.select master_fd timeout if ready data os.read master_fd 512 if not data break print got repr data elif proc.poll is..

Python C program subprocess hangs at “for line in iter”

http://stackoverflow.com/questions/20503671/python-c-program-subprocess-hangs-at-for-line-in-iter

select import select from subprocess import Popen STDOUT master_fd slave_fd pty.openpty # provide tty to enable line buffering.. exit # code is similar to _copy from pty.py with os.fdopen master_fd 'r b' 0 as master input_fds master sys.stdin while True fds.. master in fds # subprocess' output is ready data os.read master_fd 512 # doesn't block may return less if not data # EOF input_fds.remove..