# HG changeset patch # User Steve Borho # Date 2011-01-22 15:13:04 # Node ID 189edd1b15fbcba4ddb3d828fe0f10d69d17bba5 # Parent 77351c88dd1098476c587d8fbf535963c42f809e # Parent 2ef915184ff297e38e342397433440ea02abdec6 merge with stable diff --git a/mercurial/win32.py b/mercurial/win32.py --- a/mercurial/win32.py +++ b/mercurial/win32.py @@ -170,6 +170,8 @@ def termwidth(): try: # Query stderr to avoid problems with redirections screenbuf = win32console.GetStdHandle(win32console.STD_ERROR_HANDLE) + if screenbuf is None: + return 79 try: window = screenbuf.GetConsoleScreenBufferInfo()['Window'] width = window.Right - window.Left