Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/procutil.py @ 37464:632b92899203
procutil: drop unused 'newlines' option from popen*() (API)
It's unlikely for us to use the universal_newlines option.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 07 Apr 2018 21:26:37 +0900 |
parents | bbd240f81ac5 |
children | 0b63a6743010 aac4be30e250 |
comparison
equal
deleted
inserted
replaced
37463:bbd240f81ac5 | 37464:632b92899203 |
---|---|
126 p = subprocess.Popen(quotecommand(cmd), shell=True, bufsize=bufsize, | 126 p = subprocess.Popen(quotecommand(cmd), shell=True, bufsize=bufsize, |
127 close_fds=closefds, | 127 close_fds=closefds, |
128 stdin=subprocess.PIPE) | 128 stdin=subprocess.PIPE) |
129 return _pfile(p, p.stdin) | 129 return _pfile(p, p.stdin) |
130 | 130 |
131 def popen2(cmd, env=None, newlines=False): | 131 def popen2(cmd, env=None): |
132 # Setting bufsize to -1 lets the system decide the buffer size. | 132 # Setting bufsize to -1 lets the system decide the buffer size. |
133 # The default for bufsize is 0, meaning unbuffered. This leads to | 133 # The default for bufsize is 0, meaning unbuffered. This leads to |
134 # poor performance on Mac OS X: http://bugs.python.org/issue4194 | 134 # poor performance on Mac OS X: http://bugs.python.org/issue4194 |
135 p = subprocess.Popen(cmd, shell=True, bufsize=-1, | 135 p = subprocess.Popen(cmd, shell=True, bufsize=-1, |
136 close_fds=closefds, | 136 close_fds=closefds, |
137 stdin=subprocess.PIPE, stdout=subprocess.PIPE, | 137 stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
138 universal_newlines=newlines, | |
139 env=env) | 138 env=env) |
140 return p.stdin, p.stdout | 139 return p.stdin, p.stdout |
141 | 140 |
142 def popen3(cmd, env=None, newlines=False): | 141 def popen3(cmd, env=None): |
143 stdin, stdout, stderr, p = popen4(cmd, env, newlines) | 142 stdin, stdout, stderr, p = popen4(cmd, env) |
144 return stdin, stdout, stderr | 143 return stdin, stdout, stderr |
145 | 144 |
146 def popen4(cmd, env=None, newlines=False, bufsize=-1): | 145 def popen4(cmd, env=None, bufsize=-1): |
147 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, | 146 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, |
148 close_fds=closefds, | 147 close_fds=closefds, |
149 stdin=subprocess.PIPE, stdout=subprocess.PIPE, | 148 stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
150 stderr=subprocess.PIPE, | 149 stderr=subprocess.PIPE, |
151 universal_newlines=newlines, | |
152 env=env) | 150 env=env) |
153 return p.stdin, p.stdout, p.stderr, p | 151 return p.stdin, p.stdout, p.stderr, p |
154 | 152 |
155 def pipefilter(s, cmd): | 153 def pipefilter(s, cmd): |
156 '''filter string S through command CMD, returning its output''' | 154 '''filter string S through command CMD, returning its output''' |