Skip to content

Commit

Permalink
Merge pull request #284 from stanislav-tkach/release-3.0.9
Browse files Browse the repository at this point in the history
Release the 3.0.9 version
  • Loading branch information
stanislav-tkach authored Dec 21, 2021
2 parents ed3508e + 687d9a8 commit ec231dd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [3.0.9] (2021-12-21)

- NetBSD bitness detection has been fixed. (#283)

## [3.0.8] (2021-11-23)

- NetBSD support has been added. (#279)
Expand Down Expand Up @@ -231,7 +235,8 @@ All notable changes to this project will be documented in this file.

The first release containing only minor infrastructural changes and based on [os_type](https://github.com/schultyy/os_type).

[Unreleased]: https://github.com/stanislav-tkach/os_info/compare/v3.0.8...HEAD
[Unreleased]: https://github.com/stanislav-tkach/os_info/compare/v3.0.9...HEAD
[3.0.9]: https://github.com/stanislav-tkach/os_info/compare/v3.0.8...v3.0.9
[3.0.8]: https://github.com/stanislav-tkach/os_info/compare/v3.0.7...v3.0.8
[3.0.7]: https://github.com/stanislav-tkach/os_info/compare/v3.0.6...v3.0.7
[3.0.6]: https://github.com/stanislav-tkach/os_info/compare/v3.0.5...v3.0.6
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name = "os_info"
path = "src/main.rs"

[dependencies]
os_info = { version = "3.0.8", default-features = false, path = "../os_info" }
os_info = { version = "3.0.9", default-features = false, path = "../os_info" }
log = "0.4.5"
env_logger = "0.9.0"
structopt = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion os_info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "os_info"
version = "3.0.8"
version = "3.0.9"
authors = ["Jan Schulte <[email protected]>", "Stanislav Tkach <[email protected]>"]
description = "Detect the operating system type and version."
documentation = "https://docs.rs/os_info"
Expand Down
36 changes: 18 additions & 18 deletions os_info/src/bitness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ impl Display for Bitness {
target_os = "freebsd",
target_os = "linux",
target_os = "macos",
target_os = "netbsd"
))]
pub fn get() -> Bitness {
if cfg!(target_os = "netbsd") {
let bitness = match &Command::new("sysctl")
.arg("-n")
.arg("hw.machine_arch")
.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,
_ => Bitness::Unknown,
};
return bitness;
}

match &Command::new("getconf").arg("LONG_BIT").output() {
Ok(Output { stdout, .. }) if stdout == b"32\n" => Bitness::X32,
Ok(Output { stdout, .. }) if stdout == b"64\n" => Bitness::X64,
_ => Bitness::Unknown,
}
}

#[cfg(target_os = "netbsd")]
pub fn get() -> Bitness {
match &Command::new("sysctl")
.arg("-n")
.arg("hw.machine_arch")
.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,
_ => Bitness::Unknown,
}
}

#[cfg(all(
test,
any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "linux",
target_os = "macos",
target_os = "netbsd"
target_os = "netbsd",
)
))]
mod tests {
Expand Down

0 comments on commit ec231dd

Please sign in to comment.