Browse Source

split subprocess ssh_command args

Peter Rowlands 3 năm trước cách đây
mục cha
commit
63260de689
2 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 5 2
      dulwich/client.py
  2. 3 1
      dulwich/tests/test_client.py

+ 5 - 2
dulwich/client.py

@@ -1515,7 +1515,10 @@ class SubprocessSSHVendor(SSHVendor):
                 "Setting password not supported by SubprocessSSHVendor."
             )
 
-        args = [ssh_command or "ssh", "-x"]
+        if ssh_command:
+            args = ssh_command.split() + ["-x"]
+        else:
+            args = ["ssh", "-x"]
 
         if port:
             args.extend(["-p", str(port)])
@@ -1554,7 +1557,7 @@ class PLinkSSHVendor(SSHVendor):
     ):
 
         if ssh_command:
-            args = [ssh_command, "-ssh"]
+            args = ssh_command.split() + ["-ssh"]
         elif sys.platform == "win32":
             args = ["plink.exe", "-ssh"]
         else:

+ 3 - 1
dulwich/tests/test_client.py

@@ -1249,7 +1249,9 @@ class SubprocessSSHVendorTests(TestCase):
 
     def test_run_with_ssh_command(self):
         expected = [
-            "/path/to/ssh -o Option=Value",
+            "/path/to/ssh",
+            "-o",
+            "Option=Value",
             "-x",
             "host",
             "git-clone-url",