[issue3002] shutil.copyfile blocks indefinitely on named pipes

Ralf Schmitt report at bugs.python.org
Fri Jun 6 11:43:19 CEST 2008


Ralf Schmitt <schmir at gmail.com> added the comment:

The open('fifo', 'rb') already blocks. One has to use os.fdopen with
O_NONBLOCK to prevent blocking.

fd=os.open('fifo', os.O_RDONLY | os.O_NONBLOCK)

and then use

stat.S_ISFIFO(os.fstat(fd).st_mode)

to check if this is a fifo.
Checking with os.stat before opening with open will result in a race
condition.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3002>
_______________________________________


More information about the Python-bugs-list mailing list