Skip to content
Rust library to detect the operating system type
Rust RenderScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
examples Migrate to the 2018 edition Mar 19, 2019
lib
src
tests
.cspell.json Fix spellchecker warnings Mar 11, 2018
.editorconfig Numerous refactorings (#60) Mar 17, 2018
.gitattributes
.gitignore Numerous refactorings (#60) Mar 17, 2018
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.toml Release 1.1.2 version Sep 11, 2019
Changelog.md
LICENSE
README.md
appveyor.yml
build.rs
cspell-dictionary.txt

README.md

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.

You can’t perform that action at this time.