Skip to content

Commit ea21ae0

Browse files
committed
covert uname to new extext method
1 parent 44929c6 commit ea21ae0

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/bootstrap/src/core/download.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ffi::OsString;
33
use std::fs::{self, File};
44
use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Write};
55
use std::path::{Path, PathBuf};
6-
use std::process::{Command, Stdio};
6+
use std::process::Command;
77
use std::sync::OnceLock;
88

99
use 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

Comments
 (0)