Crates.io | is-root |
lib.rs | is-root |
version | 0.1.3 |
source | src |
created_at | 2020-08-16 09:22:04.81624 |
updated_at | 2023-08-04 20:18:36.976781 |
description | A simple library to detect whether you are root/admin or not |
homepage | |
repository | https://gitlab.com/caralice/is-root |
max_upload_size | |
id | 277181 |
size | 8,625 |
is-root
A simple library to detect whether you are root/admin or not
Add is-root = "0.1.2"
to [dependencies]
section in your Cargo.toml
use is_root::is_root;
if is_root() {
println!("Doing something dangerous")
} else {
eprintln!("Run me as root")
}
You can find examples in examples
directory