diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py --- a/mercurial/scmposix.py +++ b/mercurial/scmposix.py @@ -41,11 +41,11 @@ def userrcpath(): else: return [os.path.expanduser('~/.hgrc')] -def termwidth(): +def termwidth(ui): try: import array import termios - for dev in (sys.stderr, sys.stdout, sys.stdin): + for dev in (ui.ferr, ui.fout, ui.fin): try: try: fd = dev.fileno() diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py --- a/mercurial/scmwindows.py +++ b/mercurial/scmwindows.py @@ -53,5 +53,5 @@ def userrcpath(): path.append(os.path.join(userprofile, '.hgrc')) return path -def termwidth(): +def termwidth(ui): return win32.termwidth() diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -822,7 +822,7 @@ class ui(object): return int(encoding.environ['COLUMNS']) except ValueError: pass - return scmutil.termwidth() + return scmutil.termwidth(self) def formatted(self): '''should formatted output be used?