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:
commit
48d60a8247
1 changed files with 5 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue