diff mercurial/util.py @ 5292:5a65d870871d

sshrepo: fix Windows command quoting
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 10 Sep 2007 23:34:33 +0200
parents 23651848d638
children 32ec518ee3cb 1df76921aab3
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -953,6 +953,12 @@ if os.name == 'nt':
             _quotere = re.compile(r'(\\*)("|\\$)')
         return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
 
+    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 + '"'
+
     def explain_exit(code):
         return _("exited with status %d") % code, code
 
@@ -1106,6 +1112,9 @@ else:
         else:
             return "'%s'" % s.replace("'", "'\\''")
 
+    def quotecommand(cmd):
+        return cmd
+
     def testpid(pid):
         '''return False if pid dead, True if running or not sure'''
         if os.sys.platform == 'OpenVMS':