From 9a985f034bf2d819608ce7e0c52af059f65b82d4 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Jun 23 2016 07:05:00 +0000 Subject: Don't print download/upload progress outside of TTY When the output is redirected to a file, it does not make sense to print the nice progress output. Signed-off-by: Lubomír Sedlář --- diff --git a/src/pyrpkg/lookaside.py b/src/pyrpkg/lookaside.py index b48dbdd..f46da65 100644 --- a/src/pyrpkg/lookaside.py +++ b/src/pyrpkg/lookaside.py @@ -55,6 +55,11 @@ class CGILookasideCache(object): self.download_path = '%(name)s/%(filename)s/%(hash)s/%(filename)s' def print_progress(self, to_download, downloaded, to_upload, uploaded): + if not sys.stdout.isatty(): + # Don't print progress if not outputting into TTY. The progress + # output is not useful in logs. + return + if to_download > 0: done = downloaded / to_download