Skip to content

Commit

Permalink
Make use of isainfo for bitness
Browse files Browse the repository at this point in the history
uname and getconf do not report properly, but isainfo does
  • Loading branch information
martintc committed Apr 25, 2022
1 parent 18fb051 commit ebc3b0e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions os_info/src/bitness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,9 @@ pub fn get() -> Bitness {

#[cfg(target_os = "illumos")]
pub fn get() -> Bitness {
match &Command::new("uname").arg("-p").output() {
Ok(Output { stdout, .. }) if stdout == b"amd64\n" => Bitness::X64,
Ok(Output { stdout, .. }) if stdout == b"x86_64\n" => Bitness::X64,
Ok(Output { stdout, .. }) if stdout == b"i386\n" => Bitness::X32,
Ok(Output { stdout, .. }) if stdout == b"aarch64\n" => Bitness::X64,
Ok(Output { stdout, .. }) if stdout == b"earmv7hf\n" => Bitness::X32,
Ok(Output { stdout, .. }) if stdout == b"sparc64\n" => Bitness::X64,
match &Command::new("isainfo").arg("-b").output() {
Ok(Output { stdout, .. }) if stdout == b"64\n" => Bitness::X64,
Ok(Output { stdout, .. }) if stdout == b"32\n" => Bitness::X64,
_ => Bitness::Unknown,
}
}
Expand Down

0 comments on commit ebc3b0e

Please sign in to comment.