11 releases (3 stable)

1.0.2 Sep 5, 2018
1.0.1 May 27, 2018
0.7.0 Jan 21, 2018
0.6.0 Dec 17, 2017
0.4.0 Nov 12, 2017

#6 in Operating systems

Download history 143/week @ 2018-09-18 246/week @ 2018-09-25 257/week @ 2018-10-02 262/week @ 2018-10-09 269/week @ 2018-10-16 219/week @ 2018-10-23 242/week @ 2018-10-30 193/week @ 2018-11-06 231/week @ 2018-11-13 266/week @ 2018-11-20 268/week @ 2018-11-27 315/week @ 2018-12-04 190/week @ 2018-12-11

1,627 downloads per month
Used in 6 crates (1 directly)

MIT license

209KB
888 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.25+ 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.0"

Example

extern crate os_info;

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
~37K SLoC