Compare commits

...

3 Commits

Author SHA1 Message Date
mihalycsaba 304ff6a470
Merge 9babbb28d7 into 76bea74a08 2024-10-07 14:58:46 +02:00
Ryein Goddard 76bea74a08
Handle situations where terminalsize cannot be found 2024-10-07 13:59:49 +05:30
mihalycsaba 9babbb28d7
cd to script location
It's easier to quickly start the script if changes the working directory to the script's location.
2024-03-09 14:15:16 +02:00
2 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,8 @@
# #
############################################################################### ###############################################################################
#cd to script location
cd "${0%/*}"
MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"

View File

@ -234,7 +234,10 @@ def save_image(url, sess, filename='', directory=''):
break break
fh.write(chunk) fh.write(chunk)
size += len(chunk) size += len(chunk)
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0) try:
terminalsize = max(os.get_terminal_size().columns - TERMINAL_MARGIN, 0)
except OSError:
terminalsize = 80
if oldterminalsize != terminalsize: if oldterminalsize != terminalsize:
print(f'\r{"":<{terminalsize}}', end='') print(f'\r{"":<{terminalsize}}', end='')
oldterminalsize = terminalsize oldterminalsize = terminalsize