diff mercurial/windows.py @ 13188:6c9345f9edca stable

util: concentrate quoting knowledge to windows.py quotecommand() This fixes all callers of util.quotecommand() and place special knowledge of the bugfix in 2.7.1 in a single platform specific place.
author Steve Borho <steve@borho.org>
date Wed, 22 Dec 2010 13:25:00 -0600 (2010-12-22)
parents c52c629ce19e
children 650314ed845d
line wrap: on
line diff
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -160,9 +160,10 @@
 
 def quotecommand(cmd):
     """Build a command string suitable for os.popen* calls."""
-    # The extra quotes are needed because popen* runs the command
-    # through the current COMSPEC. cmd.exe suppress enclosing quotes.
-    return '"' + cmd + '"'
+    if sys.version_info < (2, 7, 1):
+        # Python versions since 2.7.1 do this extra quoting themselves
+        return '"' + cmd + '"'
+    return cmd
 
 def popen(command, mode='r'):
     # Work around "popen spawned process may not write to stdout