comparison mercurial/util.py @ 9089:8ec39725d966

util: remove unused bufsize argument Removed it correctly this time: the subprocess default is 0, not -1 and so we must pass -1 explicitly. Added a comment to that effect.
author Martin Geisler <mg@lazybytes.net>
date Thu, 09 Jul 2009 11:59:18 +0200
parents 9f191931c859
children 6cf043b1aa14 431462bd8478
comparison
equal deleted inserted replaced
9084:9f191931c859 9089:8ec39725d966
36 _fastsha1 = sha1 = _sha1 36 _fastsha1 = sha1 = _sha1
37 return _sha1(s) 37 return _sha1(s)
38 38
39 import subprocess 39 import subprocess
40 closefds = os.name == 'posix' 40 closefds = os.name == 'posix'
41 def popen2(cmd, bufsize=-1): 41 def popen2(cmd):
42 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, 42 # Setting bufsize to -1 lets the system decide the buffer size.
43 # The default for bufsize is 0, meaning unbuffered. This leads to
44 # poor performance on Mac OS X: http://bugs.python.org/issue4194
45 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
43 close_fds=closefds, 46 close_fds=closefds,
44 stdin=subprocess.PIPE, stdout=subprocess.PIPE) 47 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
45 return p.stdin, p.stdout 48 return p.stdin, p.stdout
46 def popen3(cmd, bufsize=-1): 49 def popen3(cmd):
47 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, 50 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
48 close_fds=closefds, 51 close_fds=closefds,
49 stdin=subprocess.PIPE, stdout=subprocess.PIPE, 52 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
50 stderr=subprocess.PIPE) 53 stderr=subprocess.PIPE)
51 return p.stdin, p.stdout, p.stderr 54 return p.stdin, p.stdout, p.stderr
52 55