@@ -55,8 +55,14 @@ def test_clone_private_repo(git2cpp_path, tmp_path, run_in_tmp_path, private_tes
5555 repo_path = tmp_path / private_test_repo ['repo_name' ]
5656 url = private_test_repo ['https_url' if protocol == 'https' else 'http_url' ]
5757
58- clone_cmd = [git2cpp_path .str (), "clone" , url ]
59- p_clone = subprocess .run (" " .join (clone_cmd ), capture_output = True , text = True , input = input , shell = True )
58+ clone_cmd = [git2cpp_path , "clone" , url ]
59+ #p_clone = subprocess.run(clone_cmd, capture_output=True, text=True, input=input)
60+ p_clone = subprocess .Popen (clone_cmd , stdin = subprocess .PIPE , stdout = subprocess .PIPE ,
61+ stderr = subprocess .PIPE , text = True )
62+ p_clone .stdout , p_clone .stderr = p_clone .communicate (input )
63+
64+
65+
6066 assert p_clone .returncode == 0
6167 assert repo_path .exists ()
6268 # Single request for username and password.
@@ -79,8 +85,8 @@ def test_clone_private_repo_fails_then_succeeds(
7985 input = "\n " .join (["wrong1" , "wrong2" , username , password ])
8086 repo_path = tmp_path / private_test_repo ['repo_name' ]
8187
82- clone_cmd = [git2cpp_path . str () , "clone" , private_test_repo ['https_url' ]]
83- p_clone = subprocess .run (" " . join ( clone_cmd ) , capture_output = True , text = True , input = input , shell = True )
88+ clone_cmd = [git2cpp_path , "clone" , private_test_repo ['https_url' ]]
89+ p_clone = subprocess .run (clone_cmd , capture_output = True , text = True , input = input )
8490 assert p_clone .returncode == 0
8591 assert repo_path .exists ()
8692 # Two requests for username and password.
@@ -100,8 +106,8 @@ def test_clone_private_repo_fails_on_no_username(
100106 input = ""
101107 repo_path = tmp_path / private_test_repo ['repo_name' ]
102108
103- clone_cmd = [git2cpp_path . str () , "clone" , private_test_repo ['https_url' ]]
104- p_clone = subprocess .run (" " . join ( clone_cmd ) , capture_output = True , text = True , input = input , shell = True )
109+ clone_cmd = [git2cpp_path , "clone" , private_test_repo ['https_url' ]]
110+ p_clone = subprocess .run (clone_cmd , capture_output = True , text = True , input = input )
105111
106112 assert p_clone .returncode != 0
107113 assert "No username specified" in p_clone .stderr
@@ -116,8 +122,8 @@ def test_clone_private_repo_fails_on_no_password(
116122 input = "username\n " # Note no password after the \n
117123 repo_path = tmp_path / private_test_repo ['repo_name' ]
118124
119- clone_cmd = [git2cpp_path . str () , "clone" , private_test_repo ['https_url' ]]
120- p_clone = subprocess .run (" " . join ( clone_cmd ) , capture_output = True , text = True , input = input , shell = True )
125+ clone_cmd = [git2cpp_path , "clone" , private_test_repo ['https_url' ]]
126+ p_clone = subprocess .run (clone_cmd , capture_output = True , text = True , input = input )
121127
122128 assert p_clone .returncode != 0
123129 assert "No password specified" in p_clone .stderr
0 commit comments