pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.31k stars 365 forks source link

Speed up reading from in_stream #983

Open meshy opened 5 months ago

meshy commented 5 months ago

By only sleeping when the input stream is waiting, this change ensures that we don't delay when there is still data available to read.

This provides a significant speed improvement to scripts which are passing a populated stream of data, rather than awaiting user input from stdin.

I had to modify an existing test to ensure that it continued to see sleeps.

I have also changed the default chunk read size to match Python's default, which is the "“Preferred” blocksize for efficient file system I/O."

Fixes https://github.com/pyinvoke/invoke/issues/774