Can read() be non-blocking?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Thu Nov 6 23:09:28 EST 2008


In message <gf07sh$inr$3 at lust.ihug.co.nz>, Lawrence D'Oliveiro wrote:

> In message <mailman.3600.1226012406.3487.python-list at python.org>, Thomas
> Christensen wrote:
> 
>>       r = select.select([proc.stdout.fileno()], [], [], 5)[0]
>>       if r:
>>           # NOTE: This will block since it reads until EOF
>>           data = proc.stdout.read()
> 
> No, it will read what data is available.

Sorry, maybe not. But you can set O_NOBLOCK on the fd.



More information about the Python-list mailing list