[−][src]Crate system_shutdown
system_shutdown provides a cross platform way to shut down or reboot the machine.
Supported platforms: Linux, Windows and MacOS.
Example
The example below shows how to shut down the machine:
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.
Functions
| reboot | Calls the OS-specific function to reboot the machine. |
| shutdown | Calls the OS-specific function to shut down the machine. |