# HG changeset patch # User Bryan O'Sullivan # Date 1242068007 25200 # Node ID a3826fff1e8779c6db3c4b351e81581ceef261c6 # Parent b579823cc546897907d69b045cc36cdcf99fb75c util.termwidth: a file-like object may legitimately lack a fileno() method Spotted in the wild when running a hook while pushing over HTTPS. diff -r b579823cc546 -r a3826fff1e87 mercurial/util.py --- a/mercurial/util.py Mon May 11 14:19:49 2009 +0200 +++ b/mercurial/util.py Mon May 11 11:53:27 2009 -0700 @@ -1438,7 +1438,10 @@ import termios, array, fcntl for dev in (sys.stdout, sys.stdin): try: - fd = dev.fileno() + try: + fd = dev.fileno() + except AttributeError: + continue if not os.isatty(fd): continue arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)