is_sudo

Crates.iois_sudo
lib.rsis_sudo
version0.0.1
sourcesrc
created_at2022-08-06 18:24:58.955261
updated_at2022-08-06 18:24:58.955261
descriptionChecks whether the process is running as root/sudo/admin permission in Windows and Unix systems
homepagehttps://github.com/spa5k/is_sudo
repository
max_upload_size
id639948
size8,083
Spark (spa5k)

documentation

README

Is_sudo

Checks if program is running as sudo in unix systems, or using admin permission in windows.

Usage

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"),
    }
}
Commit count: 0

cargo fmt