risoflora / system_shutdown

Rust library to shut down, reboot or log out the system.

Home Page:https://crates.io/crates/system_shutdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

system_shutdown

CI/CD Crates.io Documentation License

system_shutdown provides a cross platform way to shut down, reboot or log out operations.

Supported platforms: Linux, Windows and macOS.

Usage

Add this to your Cargo.toml:

[dependencies]
system_shutdown = "*"

and then:

use system_shutdown::shutdown;

fn main() {
    match shutdown() {
        Ok(_) => println!("Shutting down, bye!"),
        Err(error) => eprintln!("Failed to shut down: {}", error),
    }
}

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

Contributions

Pull Requests are welcome! =)

License

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

About

Rust library to shut down, reboot or log out the system.

https://crates.io/crates/system_shutdown

License:Apache License 2.0


Languages

Language:Rust 100.0%