##// END OF EJS Templates
util: handle fileno() on Python 3 throwing io.UnsupportedOperation...
Augie Fackler -
r36450:1ca4e86c default
parent child Browse files
Show More
@@ -26,6 +26,7 b' import errno'
26 import gc
26 import gc
27 import hashlib
27 import hashlib
28 import imp
28 import imp
29 import io
29 import itertools
30 import itertools
30 import mmap
31 import mmap
31 import os
32 import os
@@ -1178,7 +1179,10 b' def _sethgexecutable(path):'
1178
1179
1179 def _isstdout(f):
1180 def _isstdout(f):
1180 fileno = getattr(f, 'fileno', None)
1181 fileno = getattr(f, 'fileno', None)
1181 return fileno and fileno() == sys.__stdout__.fileno()
1182 try:
1183 return fileno and fileno() == sys.__stdout__.fileno()
1184 except io.UnsupportedOperation:
1185 return False # fileno() raised UnsupportedOperation
1182
1186
1183 def shellenviron(environ=None):
1187 def shellenviron(environ=None):
1184 """return environ with optional override, useful for shelling out"""
1188 """return environ with optional override, useful for shelling out"""
General Comments 0
You need to be logged in to leave comments. Login now