fxkit 0.1.1

Useful utilities for writting Rust CLI tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use nix::libc::geteuid;

/// Returns true if the user is root, if not then false
///
///
/// # Examples
///
/// ```rust
/// use fxkit::core::os::unix::is_root::is_root;
///
/// if is_root() {
///     println!("Yes!");
/// }
/// ```
pub fn is_root() -> bool {
    unsafe { geteuid() == 0 }
}