@@ -126,22 +126,22 @@ mod program_kind {
126
126
& [ "ssh" , "-o" , "SendEnv=GIT_PROTOCOL" , "host" ] [ ..] ,
127
127
) ,
128
128
] {
129
- assert_eq ! ( call_args( ProgramKind :: Ssh , url, protocol) , quoted ( expected) ) ;
129
+ assert_eq ! ( call_args( ProgramKind :: Ssh , url, protocol) , joined ( expected) ) ;
130
130
}
131
131
}
132
132
133
133
#[ test]
134
134
fn tortoise_plink_has_batch_command ( ) {
135
135
assert_eq ! (
136
136
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" ] )
138
138
) ;
139
139
}
140
140
141
141
#[ test]
142
142
fn port_for_all ( ) {
143
143
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") ) ;
145
145
}
146
146
}
147
147
@@ -153,7 +153,7 @@ mod program_kind {
153
153
}
154
154
assert_eq ! (
155
155
call_args( ProgramKind :: Simple , "ssh://user@host/p" , Protocol :: V2 ) ,
156
- quoted ( & [ "simple" , "user@host" ] ) ,
156
+ joined ( & [ "simple" , "user@host" ] ) ,
157
157
"simple can only do simple invocations"
158
158
) ;
159
159
}
@@ -191,8 +191,8 @@ mod program_kind {
191
191
Ok ( ( ) )
192
192
}
193
193
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 ( " " )
196
196
}
197
197
fn try_call (
198
198
kind : ProgramKind ,
@@ -207,7 +207,15 @@ mod program_kind {
207
207
try_call ( kind, url, version) . expect ( "no error" )
208
208
}
209
209
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
+ )
211
219
}
212
220
213
221
type Result = std:: result:: Result < ( ) , ssh:: invocation:: Error > ;
0 commit comments