mercurial/windows.py
changeset 14969 a3f97038c1c2
parent 14927 2aa3e07b2f07
child 14985 dbf91976f900
--- a/mercurial/windows.py	Mon Jul 25 16:04:40 2011 -0500
+++ b/mercurial/windows.py	Mon Jul 25 16:04:44 2011 -0500
@@ -99,8 +99,9 @@
 def setbinary(fd):
     # When run without console, pipes may expose invalid
     # fileno(), usually set to -1.
-    if hasattr(fd, 'fileno') and fd.fileno() >= 0:
-        msvcrt.setmode(fd.fileno(), os.O_BINARY)
+    fno = getattr(fd, 'fileno', None)
+    if fno is not None and fno() >= 0:
+        msvcrt.setmode(fno(), os.O_BINARY)
 
 def pconvert(path):
     return '/'.join(path.split(os.sep))