@@ -22,8 +22,7 @@ fn try_run(config: &Config, cmd: &mut Command) -> Result<(), ()> {
22
22
config. try_run ( cmd)
23
23
}
24
24
25
- fn extract_curl_version ( out : & [ u8 ] ) -> semver:: Version {
26
- let out = String :: from_utf8_lossy ( out) ;
25
+ fn extract_curl_version ( out : String ) -> semver:: Version {
27
26
// The output should look like this: "curl <major>.<minor>.<patch> ..."
28
27
out. lines ( )
29
28
. next ( )
@@ -32,12 +31,15 @@ fn extract_curl_version(out: &[u8]) -> semver::Version {
32
31
. unwrap_or ( semver:: Version :: new ( 1 , 0 , 0 ) )
33
32
}
34
33
35
- fn curl_version ( ) -> semver:: Version {
36
- let mut curl = Command :: new ( "curl" ) ;
34
+ fn curl_version ( config : & Config ) -> semver:: Version {
35
+ let mut curl = command ( "curl" ) ;
37
36
curl. arg ( "-V" ) ;
38
- let Ok ( out) = curl. output ( ) else { return semver:: Version :: new ( 1 , 0 , 0 ) } ;
39
- let out = out. stdout ;
40
- extract_curl_version ( & out)
37
+ let curl = curl. run_capture_stdout_exec_ctx ( config) ;
38
+ if curl. is_failure ( ) {
39
+ return semver:: Version :: new ( 1 , 0 , 0 ) ;
40
+ }
41
+ let output = curl. stdout ( ) ;
42
+ extract_curl_version ( output)
41
43
}
42
44
43
45
/// Generic helpers that are useful anywhere in bootstrap.
@@ -267,7 +269,7 @@ impl Config {
267
269
curl. arg ( "--progress-bar" ) ;
268
270
}
269
271
// --retry-all-errors was added in 7.71.0, don't use it if curl is old.
270
- if curl_version ( ) >= semver:: Version :: new ( 7 , 71 , 0 ) {
272
+ if curl_version ( self ) >= semver:: Version :: new ( 7 , 71 , 0 ) {
271
273
curl. arg ( "--retry-all-errors" ) ;
272
274
}
273
275
curl. arg ( url) ;
0 commit comments