how to get non-blocking file descriptors from a popen?
Kragen Sitaker
kragen at pobox.com
Fri Jan 25 06:28:13 EST 2002
"Gregory P. Smith" <gsmith-mysterymeat at mysterymeat-transmeta.com> writes:
> Using os.popen (or better, popen2.Popen4 objects), how can I switch the
> returned file objects to non-blocking io mode for appropriate use with
> select.poll?
Well, it varies from OS to OS, but this generally works on Unix:
flags = fcntl.fcntl (fd, FCNTL.F_GETFL, 0)
flags = flags | FCNTL.O_NONBLOCK
fcntl.fcntl (fd, FCNTL.F_SETFL, flags)
More information about the Python-list
mailing list