14 releases (6 stable)

✓ Uses Rust 2018 edition

1.1.1 Mar 22, 2019
1.1.0 Oct 13, 2018
1.0.3 Sep 23, 2018
1.0.1 May 27, 2018
0.4.0 Nov 12, 2017

#9 in Operating systems

Download history 280/week @ 2019-01-20 155/week @ 2019-01-27 269/week @ 2019-02-03 252/week @ 2019-02-10 158/week @ 2019-02-17 187/week @ 2019-02-24 227/week @ 2019-03-03 216/week @ 2019-03-10 348/week @ 2019-03-17 453/week @ 2019-03-24 482/week @ 2019-03-31 515/week @ 2019-04-07 377/week @ 2019-04-14 429/week @ 2019-04-21 486/week @ 2019-04-28

1,146 downloads per month
Used in 7 crates (2 directly)

MIT license

204KB
884 lines

os_info

Status: Travis Build Status CircleCI Build Status AppVeyor Build Status

Project info: Docs.rs Latest Version License

Project details: LoC rust 1.33+ required dependency status

Overview

Library for detecting the operating system type and version.

Based on os_type. The main difference of os_info is that this library separates completely incompatible operating systems by conditional compilation and uses specific system API whenever is possible.

Usage

To use this crate, add os_info as a dependency to your project's Cargo.toml:

[dependencies]
os_info = "1.1.1"

Example

let info = os_info::get();

// Print full information:
println!("OS information: {}", info);

// Print information separately:
println!("Type: {}", info.os_type());
println!("Version: {}", info.version());

Right now, the following operating system types can be returned:

  • Unknown
  • Redhat
  • CentOS
  • Fedora
  • OSX
  • Ubuntu
  • Debian
  • Arch
  • Redox
  • Windows
  • Alpine

If you need support for more OS types, I am looking forward to your Pull Request.

Requirements

On Linux based systems this library requires that lsb_release is installed.

License

os_info is licensed under the MIT license. See LICENSE for the details.

Dependencies

~1.5MB
~35K SLoC