Crates.io | is_sudo |
lib.rs | is_sudo |
version | 0.0.1 |
source | src |
created_at | 2022-08-06 18:24:58.955261 |
updated_at | 2022-08-06 18:24:58.955261 |
description | Checks whether the process is running as root/sudo/admin permission in Windows and Unix systems |
homepage | https://github.com/spa5k/is_sudo |
repository | |
max_upload_size | |
id | 639948 |
size | 8,083 |
use is_sudo::check;
use is_sudo::RunningAs;
fn main() {
let running_as: RunningAs = is_sudo::check();
match running_as {
RunningAs::Root => println!("Running as root"),
RunningAs::User => println!("Running as user"),
}
}