Merge pull request #10774 from gavindsouza/termianl-progress-updates-fix

fix: Handle progress updates if command not executed via terminal
This commit is contained in:
mergify[bot] 2020-06-23 08:01:33 +00:00 committed by GitHub
commit 48d60a8247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -400,7 +400,11 @@ def call_hook_method(hook, *args, **kwargs):
def update_progress_bar(txt, i, l):
if not getattr(frappe.local, 'request', None):
lt = len(txt)
col = 40 if os.get_terminal_size().columns > 80 else 20
try:
col = 40 if os.get_terminal_size().columns > 80 else 20
except OSError:
# in case function isn't being called from a terminal
col = 40
if lt < 36:
txt = txt + " "*(36-lt)