1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

Use subprocess to call stty size when COLUMNS is not set

This commit is contained in:
Philipp Hagemeister 2011-08-24 23:28:30 +02:00
parent 2c8d32de33
commit 4f2a5e06da

View file

@ -2996,11 +2996,12 @@ def parseOpts():
if columns:
return int(columns)
# TODO: Breaks on phihag's system
#if sys.platform.startswith('linux'):
# try:
# return os.popen('stty size', 'r').read().split()[1]
# except: pass
try:
sp = subprocess.Popen(['stty', 'size'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = sp.communicate()
return out.split()[1]
except:
pass
return None
max_width = 80