Peter Gsellmann <[EMAIL PROTECTED]> writes: > Will McDonald wrote:
>> That's a good point. I did wonder if it'd just have to sit there >> waiting for input much like cat would. I think that's preferable, and >> simpler :), than implementing timeouts. >> > In unix you can always use select.select() on files and pipes as sys.stdin > is. Use a timout-value of 0 and you get the 'ready-state' of the file > descriptor i.e. the presence of waiting input-data. If you terminate when select() indicates that there is nothing more to read, you will terminate prematurely in many cases. Even 'dd if=/dev/zero | myprogram.py' will stop at some random point, when the OS happens to decide that myprogram.py should be scheduled twice without dd getting the chance to fill the pipe buffer inbetween. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "We don't understand the software, and ! bellman @ lysator.liu.se sometimes we don't understand the hardware, ! but we can *see* the blinking lights!" ! Make Love -- Nicht Wahr!
-- http://mail.python.org/mailman/listinfo/python-list