9 stable releases (3 major)

4.0.1 Jan 13, 2023
4.0.0 Nov 28, 2022
3.0.0 Dec 19, 2019
2.1.0 Dec 18, 2019
1.0.2 Dec 17, 2019

#84 in Hardware support

Download history 10835/week @ 2023-12-13 10072/week @ 2023-12-20 11974/week @ 2023-12-27 11033/week @ 2024-01-03 10795/week @ 2024-01-10 11145/week @ 2024-01-17 10125/week @ 2024-01-24 12154/week @ 2024-01-31 13635/week @ 2024-02-07 7817/week @ 2024-02-14 6144/week @ 2024-02-21 8591/week @ 2024-02-28 9204/week @ 2024-03-06 11145/week @ 2024-03-13 13381/week @ 2024-03-20 11785/week @ 2024-03-27

46,923 downloads per month
Used in 2 crates

MIT/Apache

27KB
618 lines

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]
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.

Contributions

Pull Requests are welcome! =)

License

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

Dependencies

~0–50MB
~694K SLoC