diff --git a/src/modules/username.rs b/src/modules/username.rs index ff38cf69..c25a5bd2 100644 --- a/src/modules/username.rs +++ b/src/modules/username.rs @@ -19,13 +19,13 @@ const USERNAME_ENV_VAR: &str = "USERNAME"; /// Does not display the username: /// - If the option `username.detect_env_vars` is set with a negated environment variable [A] pub fn module<'a>(context: &'a Context) -> Option> { - #[cfg(not(test))] + #[cfg(not(any(test, target_os = "android")))] let mut username = whoami::fallible::username() .inspect_err(|e| log::debug!("Failed to get username {e:?}")) .ok() .or_else(|| context.get_env(USERNAME_ENV_VAR))?; - #[cfg(test)] + #[cfg(any(test, target_os = "android"))] let mut username = context.get_env(USERNAME_ENV_VAR)?; let mut module = context.new_module("username");