This commit is contained in:
Adrian Heine 2020-10-17 23:44:52 +02:00
parent b53267f406
commit da98bfba8c
20 changed files with 80 additions and 61 deletions

View file

@ -15,7 +15,7 @@ pub struct User<U, C> {
}
impl<U, C> User<U, C> {
pub fn new(user_name: U, command_runner: C) -> Self {
pub const fn new(user_name: U, command_runner: C) -> Self {
Self {
user_name,
command_runner,
@ -41,7 +41,7 @@ impl<U: AsRef<str>, C: CommandRunner> Symbol for User<U, C> {
// adduser is not reentrant because finding the next uid
// and creating the account is not an atomic operation
let wait = WAIT.acquire().await;
self
let res = self
.command_runner
.run_successfully(
"adduser",
@ -51,7 +51,9 @@ impl<U: AsRef<str>, C: CommandRunner> Symbol for User<U, C> {
self.user_name.as_ref(),
],
)
.await
.await;
drop(wait);
res
}
}