]> arthur.barton.de Git - bup.git/blobdiff - helpers.py
Add a new 'bup newliner' that fixes progress message whitespace.
[bup.git] / helpers.py
index 2036ff4cc12a769b3a5d9ddbc73fd77f8a5e9532..75cf09cb240a4f8aa9d12b629855a3ed87d92b0e 100644 (file)
@@ -251,13 +251,19 @@ def count(l):
     return reduce(lambda x,y: x+1, l)
 
 
+def atoi(s):
+    try:
+        return int(s or '0')
+    except ValueError:
+        return 0
+
+
 saved_errors = []
 def add_error(e):
     saved_errors.append(e)
     log('%-70s\n' % e)
 
-
-istty = os.isatty(2)
+istty = os.isatty(2) or atoi(os.environ.get('BUP_FORCE_TTY'))
 def progress(s):
     if istty:
         log(s)