This minimize overhead of the time() function when stderr is not
connected to a terminal.
Signed-off-by: Alexander Barton <alex@barton.de>
"""Calls progress() only if we haven't printed progress in a while.
This avoids overloading the stderr buffer with excess junk.
+ We do the TTY check here, too, to minimize overhead of the time() function.
"""
global _last_prog
- now = time.time()
- if now - _last_prog > 0.1:
- progress(s)
- _last_prog = now
+ if istty2:
+ now = time.time()
+ if now - _last_prog > 0.1:
+ progress(s)
+ _last_prog = now
def mkdirp(d, mode=None):