15 releases (7 stable)

✓ Uses Rust 2018 edition

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

#7 in Operating systems

Download history 212/week @ 2019-05-29 451/week @ 2019-06-05 715/week @ 2019-06-12 4026/week @ 2019-06-19 3642/week @ 2019-06-26 1542/week @ 2019-07-03 3845/week @ 2019-07-10 5642/week @ 2019-07-17 2891/week @ 2019-07-24 4569/week @ 2019-07-31 5418/week @ 2019-08-07 5612/week @ 2019-08-14 2928/week @ 2019-08-21 2918/week @ 2019-08-28 5221/week @ 2019-09-04

16,335 downloads per month
Used in 9 crates (4 directly)

MIT license

205KB
904 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.2"

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–1.6MB
~38K SLoC