From bcbd3966732871818b9709669e5a5cc894247531 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 24 Mar 2018 01:31:26 +0300 Subject: [PATCH] Fix(scripts/ml-import.py): Inhibit progress bar if stdout is not terminal --- docs/news.rst | 5 +++++ scripts/ml-import.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/news.rst b/docs/news.rst index 3e73f9a..03347a1 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,11 @@ News ==== +Version 0.0.17 (2018-03-??) +--------------------------- + +* Inhibit progress bar if stdout is not terminal. + Version 0.0.16 (2018-03-22) --------------------------- diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 47c6b1b..169a715 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -27,8 +27,9 @@ if __name__ == '__main__': open_db(args.database) init_db() import_glst() + use_pbar = ttyProgressBar and not args.no_pbar and sys.stdout.isatty() for inpx in args.inpx: - if ttyProgressBar and not args.no_pbar: + if use_pbar: if len(inpx) > 25: pbar_fname = inpx[:22] + '...' else: -- 2.39.2