1 stable release
1.0.1 | Sep 18, 2022 |
---|
#127 in #solution
2,530 downloads per month
5KB
56 lines
is_superuser
A simple cross-platform solution for deciding if a given user is privileged. Works on Unix (Linux and MacOS) and Windows, please make an issue if it doesn't work for you!
Usage:
use is_superuser::is_superuser;
fn main() {
if is_superuser() {
println!("I am running with sudo/admin privileges!");
} else {
println!("I am a normal user!");
}
}
lib.rs
:
A simple cross-platform solution for deciding if a given user is privileged. Works on Unix (Linux and MacOS) and Windows, please make an issue if it doesn't work for you!
Usage:
use is_superuser::is_superuser;
fn main() {
if is_superuser() {
println!("I am running with sudo/admin privileges!");
} else {
println!("I am a normal user!");
}
}
Dependencies
~220KB