@@ -3,7 +3,7 @@ use std::ffi::OsString;
33use std:: fs:: { self , File } ;
44use std:: io:: { BufRead , BufReader , BufWriter , ErrorKind , Write } ;
55use std:: path:: { Path , PathBuf } ;
6- use std:: process:: { Command , Stdio } ;
6+ use std:: process:: Command ;
77use std:: sync:: OnceLock ;
88
99use xz2:: bufread:: XzDecoder ;
@@ -87,20 +87,14 @@ impl Config {
8787 /// on NixOS
8888 fn should_fix_bins_and_dylibs ( & self ) -> bool {
8989 let val = * SHOULD_FIX_BINS_AND_DYLIBS . get_or_init ( || {
90- match Command :: new ( "uname" ) . arg ( "-s" ) . stderr ( Stdio :: inherit ( ) ) . output ( ) {
91- Err ( _) => return false ,
92- Ok ( output) if !output. status . success ( ) => return false ,
93- Ok ( output) => {
94- let mut os_name = output. stdout ;
95- if os_name. last ( ) == Some ( & b'\n' ) {
96- os_name. pop ( ) ;
97- }
98- if os_name != b"Linux" {
99- return false ;
100- }
101- }
90+ let uname = command ( "uname" ) . arg ( "-s" ) . run_capture_stdout_exec_ctx ( self ) ;
91+ if uname. is_failure ( ) {
92+ return false ;
93+ }
94+ let output = uname. stdout ( ) ;
95+ if !output. starts_with ( "Linux" ) {
96+ return false ;
10297 }
103-
10498 // If the user has asked binaries to be patched for Nix, then
10599 // don't check for NixOS or `/lib`.
106100 // NOTE: this intentionally comes after the Linux check:
0 commit comments