@@ -3,7 +3,7 @@ use std::ffi::OsString;
3
3
use std:: fs:: { self , File } ;
4
4
use std:: io:: { BufRead , BufReader , BufWriter , ErrorKind , Write } ;
5
5
use std:: path:: { Path , PathBuf } ;
6
- use std:: process:: { Command , Stdio } ;
6
+ use std:: process:: Command ;
7
7
use std:: sync:: OnceLock ;
8
8
9
9
use xz2:: bufread:: XzDecoder ;
@@ -87,20 +87,14 @@ impl Config {
87
87
/// on NixOS
88
88
fn should_fix_bins_and_dylibs ( & self ) -> bool {
89
89
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 ;
102
97
}
103
-
104
98
// If the user has asked binaries to be patched for Nix, then
105
99
// don't check for NixOS or `/lib`.
106
100
// NOTE: this intentionally comes after the Linux check:
0 commit comments