]> git.phdru.name Git - m_librarian.git/commitdiff
Fix(scripts/ml-import.py): Inhibit progress bar if stdout is not terminal
authorOleg Broytman <phd@phdru.name>
Fri, 23 Mar 2018 22:31:26 +0000 (01:31 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 23 Mar 2018 22:31:26 +0000 (01:31 +0300)
docs/news.rst
scripts/ml-import.py

index 3e73f9a7137b70f8f9bf403cd734d4ed97f34c3b..03347a1b9846ac7f5d6bf30d9f7ecd4bd2413e3d 100644 (file)
@@ -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)
 ---------------------------
 
index 47c6b1b2056e39139221acb474571db305edf75c..169a715f217721b976dc90e98f1065bd29a92fb1 100755 (executable)
@@ -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: