Fix appveyor and windows. Resolves #293

This commit is contained in:
Anthony Sottile
2015-11-23 20:10:08 -08:00
parent 1cdbe38b5f
commit 248930f6dc
7 changed files with 60 additions and 34 deletions

View File

@@ -12,13 +12,14 @@ from pre_commit import five
try:
if not os.environ.get('TERM'): # pragma: no cover (dumb terminal)
raise OSError('Cannot determine width without TERM')
COLS = int(
subprocess.Popen(
('tput', 'cols'), stdout=subprocess.PIPE,
).communicate()[0] or
# Default in the case of no terminal
80
)
else: # pragma no cover (windows)
COLS = int(
subprocess.Popen(
('tput', 'cols'), stdout=subprocess.PIPE,
).communicate()[0] or
# Default in the case of no terminal
80
)
except OSError: # pragma: no cover (windows)
COLS = 80