@@ -126,22 +126,22 @@ mod program_kind {
126126 & [ "ssh" , "-o" , "SendEnv=GIT_PROTOCOL" , "host" ] [ ..] ,
127127 ) ,
128128 ] {
129- assert_eq ! ( call_args( ProgramKind :: Ssh , url, protocol) , quoted ( expected) ) ;
129+ assert_eq ! ( call_args( ProgramKind :: Ssh , url, protocol) , joined ( expected) ) ;
130130 }
131131 }
132132
133133 #[ test]
134134 fn tortoise_plink_has_batch_command ( ) {
135135 assert_eq ! (
136136 call_args( ProgramKind :: TortoisePlink , "ssh://user@host:42/p" , Protocol :: V2 ) ,
137- quoted ( & [ "tortoiseplink.exe" , "-batch" , "-P" , "42" , "user@host" ] )
137+ joined ( & [ "tortoiseplink.exe" , "-batch" , "-P" , "42" , "user@host" ] )
138138 ) ;
139139 }
140140
141141 #[ test]
142142 fn port_for_all ( ) {
143143 for kind in [ ProgramKind :: TortoisePlink , ProgramKind :: Plink , ProgramKind :: Putty ] {
144- assert ! ( call_args( kind, "ssh://user@host:43/p" , Protocol :: V2 ) . ends_with( r#""-P" "43" " user@host""# ) ) ;
144+ assert ! ( call_args( kind, "ssh://user@host:43/p" , Protocol :: V2 ) . ends_with( "-P 43 user@host") ) ;
145145 }
146146 }
147147
@@ -153,7 +153,7 @@ mod program_kind {
153153 }
154154 assert_eq ! (
155155 call_args( ProgramKind :: Simple , "ssh://user@host/p" , Protocol :: V2 ) ,
156- quoted ( & [ "simple" , "user@host" ] ) ,
156+ joined ( & [ "simple" , "user@host" ] ) ,
157157 "simple can only do simple invocations"
158158 ) ;
159159 }
@@ -191,8 +191,8 @@ mod program_kind {
191191 Ok ( ( ) )
192192 }
193193
194- fn quoted ( input : & [ & str ] ) -> String {
195- input. iter ( ) . map ( |s| format ! ( " \" {s} \" " ) ) . collect :: < Vec < _ > > ( ) . join ( " " )
194+ fn joined ( input : & [ & str ] ) -> String {
195+ input. iter ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . join ( " " )
196196 }
197197 fn try_call (
198198 kind : ProgramKind ,
@@ -207,7 +207,15 @@ mod program_kind {
207207 try_call ( kind, url, version) . expect ( "no error" )
208208 }
209209 fn call_args ( kind : ProgramKind , url : & str , version : Protocol ) -> String {
210- format ! ( "{:?}" , std:: process:: Command :: from( call( kind, url, version) ) )
210+ let cmd = std:: process:: Command :: from ( call ( kind, url, version) ) ;
211+ format ! (
212+ "{} {}" ,
213+ cmd. get_program( ) . to_string_lossy( ) ,
214+ cmd. get_args( )
215+ . map( |arg| arg. to_string_lossy( ) . into_owned( ) )
216+ . collect:: <Vec <_>>( )
217+ . join( " " )
218+ )
211219 }
212220
213221 type Result = std:: result:: Result < ( ) , ssh:: invocation:: Error > ;
0 commit comments