Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
5291:23651848d638 | 5292:5a65d870871d |
---|---|
951 global _quotere | 951 global _quotere |
952 if _quotere is None: | 952 if _quotere is None: |
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 |
959 # if you change this stub into a real check, please try to implement the | 965 # if you change this stub into a real check, please try to implement the |
960 # username and groupname functions above, too. | 966 # username and groupname functions above, too. |
1103 def shellquote(s): | 1109 def shellquote(s): |
1104 if os.sys.platform == 'OpenVMS': | 1110 if os.sys.platform == 'OpenVMS': |
1105 return '"%s"' % s | 1111 return '"%s"' % s |
1106 else: | 1112 else: |
1107 return "'%s'" % s.replace("'", "'\\''") | 1113 return "'%s'" % s.replace("'", "'\\''") |
1114 | |
1115 def quotecommand(cmd): | |
1116 return cmd | |
1108 | 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': |
1112 return True | 1121 return True |