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

#50 in Hardware support

Download history 10960/week @ 2024-01-07 10965/week @ 2024-01-14 10544/week @ 2024-01-21 11413/week @ 2024-01-28 13522/week @ 2024-02-04 10928/week @ 2024-02-11 5109/week @ 2024-02-18 7511/week @ 2024-02-25 9153/week @ 2024-03-03 10641/week @ 2024-03-10 12489/week @ 2024-03-17 13788/week @ 2024-03-24 13117/week @ 2024-03-31 14532/week @ 2024-04-07 13311/week @ 2024-04-14 11797/week @ 2024-04-21

54,119 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–44MB
~674K SLoC