##// END OF EJS Templates
util.system: compare fileno to see if it needs stdout redirection...
Yuya Nishihara -
r26450:1138e1d0 default
parent child Browse files
Show More
@@ -730,6 +730,10 b' def _sethgexecutable(path):'
730 global _hgexecutable
730 global _hgexecutable
731 _hgexecutable = path
731 _hgexecutable = path
732
732
733 def _isstdout(f):
734 fileno = getattr(f, 'fileno', None)
735 return fileno and fileno() == sys.__stdout__.fileno()
736
733 def system(cmd, environ=None, cwd=None, onerr=None, errprefix=None, out=None):
737 def system(cmd, environ=None, cwd=None, onerr=None, errprefix=None, out=None):
734 '''enhanced shell command execution.
738 '''enhanced shell command execution.
735 run with environment maybe modified, maybe in different dir.
739 run with environment maybe modified, maybe in different dir.
@@ -765,7 +769,7 b' def system(cmd, environ=None, cwd=None, '
765 env = dict(os.environ)
769 env = dict(os.environ)
766 env.update((k, py2shell(v)) for k, v in environ.iteritems())
770 env.update((k, py2shell(v)) for k, v in environ.iteritems())
767 env['HG'] = hgexecutable()
771 env['HG'] = hgexecutable()
768 if out is None or out == sys.__stdout__:
772 if out is None or _isstdout(out):
769 rc = subprocess.call(cmd, shell=True, close_fds=closefds,
773 rc = subprocess.call(cmd, shell=True, close_fds=closefds,
770 env=env, cwd=cwd)
774 env=env, cwd=cwd)
771 else:
775 else:
General Comments 0
You need to be logged in to leave comments. Login now