mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
test(username): Default to false for is_root_user() regardless of the OS (#6358)
Default to false for tests regardless of the OS Checking for username along with cfg!(test) seems redundant, especially because of one edge case - root user can be renamed
This commit is contained in:
@@ -109,12 +109,12 @@ fn is_root_user() -> bool {
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "windows", test))]
|
||||
#[cfg(test)]
|
||||
fn is_root_user() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(all(not(target_os = "windows"), not(test)))]
|
||||
fn is_root_user() -> bool {
|
||||
nix::unistd::geteuid() == nix::unistd::ROOT
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user