system_shutdown 2.0.1

Rust library for shut down/reboot the system.
Documentation

system_shutdown

Build Status Crates.io Documentation License

system_shutdown provides a cross platform way to shut down or reboot the machine.

Supported platforms: Linux, Windows and MacOS.

Example

The example below shows how to shut down the machine:

extern crate system_shutdown;

use system_shutdown::shutdown;

fn main() {
    match shutdown(true) {
        None => println!("Shutting down, bye!"),
        Some(code) => println!("Failed to shut down. (Os code: {})", code),
    }
}

In most of the systems it does not require the user to be root/admin.

Usage

Add this to your Cargo.toml:

[dependencies]
system_shutdown = "2.0.1"

and this to your crate root:

extern crate system_shutdown;

Contributions

Pull Requests and Issues welcome!

License

system_shutdown is licensed under either of the following, at your option: