X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=blobdiff_plain;f=helpers.py;h=75cf09cb240a4f8aa9d12b629855a3ed87d92b0e;hp=2036ff4cc12a769b3a5d9ddbc73fd77f8a5e9532;hb=073b383882e73904ae04179e69a68419d8d57199;hpb=567f487fcfeeb83399dbce92c37cf3b56ad6abfc diff --git a/helpers.py b/helpers.py index 2036ff4..75cf09c 100644 --- a/helpers.py +++ b/helpers.py @@ -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)