Skip to content

Commit

Permalink
Only warn once about the nixbld users
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Dec 7, 2024
1 parent 9a9d043 commit 747affe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/action/base/create_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use crate::execute_command;

use crate::action::{Action, ActionDescription, StatefulAction};

static WARNED_USER_HIDDEN: std::sync::atomic::AtomicBool =
std::sync::atomic::AtomicBool::new(false);

/**
Create an operating system level user in the given group
*/
Expand Down Expand Up @@ -343,7 +346,9 @@ async fn create_user_macos(name: &str, uid: u32, gid: u32) -> Result<(), ActionE
.or_else(|e| {
if let ActionErrorKind::CommandOutput { ref output, .. } = e {
if output.status.signal() == Some(9) {
tracing::warn!("Failed to automatically mark the user as hidden. See: https://dtr.mn/mark-user-hidden");
if !WARNED_USER_HIDDEN.swap(true, std::sync::atomic::Ordering::SeqCst) {
tracing::warn!("Failed to automatically mark nixbld users as hidden. See: https://dtr.mn/mark-user-hidden");
}
return Ok(())
}
}
Expand Down

0 comments on commit 747affe

Please sign in to comment.