util.termwidth: a file-like object may legitimately lack a fileno() method
Spotted in the wild when running a hook while pushing over HTTPS.
--- 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)