Crates.io | system_shutdown |
lib.rs | system_shutdown |
version | 4.0.1 |
source | src |
created_at | 2019-12-17 14:58:50.81322 |
updated_at | 2023-01-13 21:57:15.059424 |
description | Rust library for shut down, reboot or log out operations. |
homepage | https://github.com/risoflora/system_shutdown |
repository | https://github.com/risoflora/system_shutdown |
max_upload_size | |
id | 190014 |
size | 66,986 |
system_shutdown
system_shutdown
provides a cross platform way to shut down, reboot or log out operations.
Supported platforms: Linux, Windows and macOS.
Add this to your Cargo.toml
:
[dependencies]
lock_keys = "*"
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.
Pull Requests are welcome! =)
system_shutdown
is licensed under either of the following, at your option: