diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2011-08-24 23:28:30 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2011-08-24 23:28:30 +0200 |
commit | 4f2a5e06da89913f789463fef919e61f9d8f5be6 (patch) | |
tree | ce3fd43f30ba7952cc528c5c99752319570f4dda | |
parent | 2c8d32de33dd6618659cd1fe98dcdf09fde1ecaf (diff) |
Use subprocess to call stty size when COLUMNS is not set
-rwxr-xr-x | youtube-dl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/youtube-dl b/youtube-dl index 1ae68b2b5..32bd99e98 100755 --- a/youtube-dl +++ b/youtube-dl @@ -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 |