##// END OF EJS Templates
sshrepo: fix Windows command quoting
Alexis S. L. Carvalho -
r5292:5a65d870 default
parent child Browse files
Show More
@@ -35,7 +35,7 b' class sshrepository(remoterepository):'
35 cmd = cmd % (sshcmd, args, remotecmd, self.path)
35 cmd = cmd % (sshcmd, args, remotecmd, self.path)
36
36
37 ui.note('running %s\n' % cmd)
37 ui.note('running %s\n' % cmd)
38 res = os.system(cmd)
38 res = util.system(cmd)
39 if res != 0:
39 if res != 0:
40 self.raise_(hg.RepoError(_("could not create remote repo")))
40 self.raise_(hg.RepoError(_("could not create remote repo")))
41
41
@@ -51,6 +51,7 b' class sshrepository(remoterepository):'
51 cmd = '%s %s "%s -R %s serve --stdio"'
51 cmd = '%s %s "%s -R %s serve --stdio"'
52 cmd = cmd % (sshcmd, args, remotecmd, self.path)
52 cmd = cmd % (sshcmd, args, remotecmd, self.path)
53
53
54 cmd = util.quotecommand(cmd)
54 ui.note('running %s\n' % cmd)
55 ui.note('running %s\n' % cmd)
55 self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
56 self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
56
57
@@ -953,6 +953,12 b" if os.name == 'nt':"
953 _quotere = re.compile(r'(\\*)("|\\$)')
953 _quotere = re.compile(r'(\\*)("|\\$)')
954 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
954 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
955
955
956 def quotecommand(cmd):
957 """Build a command string suitable for os.popen* calls."""
958 # The extra quotes are needed because popen* runs the command
959 # through the current COMSPEC. cmd.exe suppress enclosing quotes.
960 return '"' + cmd + '"'
961
956 def explain_exit(code):
962 def explain_exit(code):
957 return _("exited with status %d") % code, code
963 return _("exited with status %d") % code, code
958
964
@@ -1106,6 +1112,9 b' else:'
1106 else:
1112 else:
1107 return "'%s'" % s.replace("'", "'\\''")
1113 return "'%s'" % s.replace("'", "'\\''")
1108
1114
1115 def quotecommand(cmd):
1116 return cmd
1117
1109 def testpid(pid):
1118 def testpid(pid):
1110 '''return False if pid dead, True if running or not sure'''
1119 '''return False if pid dead, True if running or not sure'''
1111 if os.sys.platform == 'OpenVMS':
1120 if os.sys.platform == 'OpenVMS':
General Comments 0
You need to be logged in to leave comments. Login now