system_shutdown
system_shutdown
provides a cross platform way to shut down or reboot the machine.
Supported platforms: Linux, Windows and MacOS.
The example below shows how to shut down the machine:
```rust extern crate system_shutdown;
use system_shutdown::shutdown;
fn main() { if shutdown(true) { println!("Shutting down, bye!"); } else { println!("Failed to shut down."); } } ```
In most of the systems it does not require the user to be root/admin.
Add this to your Cargo.toml
:
ini
[dependencies]
system_shutdown = "1.0.0"
and this to your crate root:
rust
extern crate system_shutdown;
Pull Requests and Issues welcome!
system_shutdown
is licensed under either of the following, at your option: