##// END OF EJS Templates
util: concentrate quoting knowledge to windows.py quotecommand()...
Steve Borho -
r13188:6c9345f9 stable
parent child Browse files
Show More
@@ -391,9 +391,7 b' def system(cmd, environ={}, cwd=None, on'
391 return '1'
391 return '1'
392 return str(val)
392 return str(val)
393 origcmd = cmd
393 origcmd = cmd
394 if os.name == 'nt' and sys.version_info < (2, 7, 1):
394 cmd = quotecommand(cmd)
395 # Python versions since 2.7.1 do this extra quoting themselves
396 cmd = '"%s"' % cmd
397 env = dict(os.environ)
395 env = dict(os.environ)
398 env.update((k, py2shell(v)) for k, v in environ.iteritems())
396 env.update((k, py2shell(v)) for k, v in environ.iteritems())
399 env['HG'] = hgexecutable()
397 env['HG'] = hgexecutable()
@@ -160,9 +160,10 b' def shellquote(s):'
160
160
161 def quotecommand(cmd):
161 def quotecommand(cmd):
162 """Build a command string suitable for os.popen* calls."""
162 """Build a command string suitable for os.popen* calls."""
163 # The extra quotes are needed because popen* runs the command
163 if sys.version_info < (2, 7, 1):
164 # through the current COMSPEC. cmd.exe suppress enclosing quotes.
164 # Python versions since 2.7.1 do this extra quoting themselves
165 return '"' + cmd + '"'
165 return '"' + cmd + '"'
166 return cmd
166
167
167 def popen(command, mode='r'):
168 def popen(command, mode='r'):
168 # Work around "popen spawned process may not write to stdout
169 # Work around "popen spawned process may not write to stdout
General Comments 0
You need to be logged in to leave comments. Login now