mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-11 05:42:21 +00: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:
parent
90721faa0b
commit
639c7c6285
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user