mercurial/util.py
changeset 36432 1ca4e86c7265
parent 36422 04c319a07c7b
child 36524 bfe38f787d5b
equal deleted inserted replaced
36431:ec43960b03e8 36432:1ca4e86c7265
    24 import datetime
    24 import datetime
    25 import errno
    25 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
    32 import platform as pyplatform
    33 import platform as pyplatform
    33 import re as remod
    34 import re as remod
  1176     global _hgexecutable
  1177     global _hgexecutable
  1177     _hgexecutable = path
  1178     _hgexecutable = 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"""
  1185     def py2shell(val):
  1189     def py2shell(val):
  1186         'convert python object into string that is useful to shell'
  1190         'convert python object into string that is useful to shell'