[PATCH] ssh: use shlex to parse command line
Steve Borho
steve at borho.org
Thu Sep 6 15:44:04 CDT 2007
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1189111299 18000
# Node ID 2cb669d7c6f6b52ff816e5ea2a0e89513a2c8044
# Parent f8c36b215281a7e8f3aaed632206d3627ee21e6e
ssh: use shlex to parse command line
diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py
--- a/mercurial/sshrepo.py
+++ b/mercurial/sshrepo.py
@@ -8,7 +8,7 @@ from node import *
from node import *
from remoterepo import *
from i18n import _
-import repo, os, re, stat, util
+import repo, os, re, stat, util, shlex
class sshrepository(remoterepository):
def __init__(self, ui, path, create=0):
@@ -35,8 +35,8 @@ class sshrepository(remoterepository):
cmd = cmd % (sshcmd, args, remotecmd, self.path)
ui.note('running %s\n' % cmd)
- res = os.system(cmd)
- if res != 0:
+ i, o = os.popen2(shlex.split(cmd), 'b')
+ if i.close():
self.raise_(repo.RepoError(_("could not create remote repo")))
self.validate_repo(ui, sshcmd, args, remotecmd)
@@ -52,7 +52,7 @@ class sshrepository(remoterepository):
cmd = cmd % (sshcmd, args, remotecmd, self.path)
ui.note('running %s\n' % cmd)
- self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
+ self.pipeo, self.pipei, self.pipee = os.popen3(shlex.split(cmd), 'b')
# skip any noise generated by remote shell
self.do_cmd("hello")
More information about the Mercurial-devel
mailing list