11//! Process management.
22
33#[ cfg( unix) ]
4- pub use self :: unix:: { Args , Config , Process } ;
4+ pub use self :: unix:: { Args , Config , Process , UserId , GroupId } ;
55
66#[ cfg( target_os = "linux" ) ]
77pub use self :: linux:: EnvSockets ;
@@ -491,10 +491,20 @@ mod unix {
491491 Ok ( self )
492492 }
493493
494+ pub fn with_user_id ( mut self , user_id : UserId ) -> Self {
495+ self . user = Some ( user_id) ;
496+ self
497+ }
498+
494499 pub fn with_group ( mut self , v : & str ) -> Result < Self , String > {
495500 self . group = Some ( GroupId :: from_str ( v) ?) ;
496501 Ok ( self )
497502 }
503+
504+ pub fn with_group_id ( mut self , group_id : GroupId ) -> Self {
505+ self . group = Some ( group_id) ;
506+ self
507+ }
498508 }
499509
500510
@@ -505,23 +515,23 @@ mod unix {
505515 pub struct Args {
506516 /// The file for keep the daemon process's PID in
507517 #[ arg( long, value_name = "PATH" ) ]
508- pid_file : Option < ConfigPath > ,
518+ pub pid_file : Option < ConfigPath > ,
509519
510520 /// The working directory of the daemon process
511521 #[ arg( long, value_name = "PATH" ) ]
512- working_dir : Option < ConfigPath > ,
522+ pub working_dir : Option < ConfigPath > ,
513523
514524 /// Root directory for the daemon process
515525 #[ arg( long, value_name = "PATH" ) ]
516- chroot : Option < ConfigPath > ,
526+ pub chroot : Option < ConfigPath > ,
517527
518528 /// User for the daemon process
519529 #[ arg( long, value_name = "UID" ) ]
520- user : Option < UserId > ,
530+ pub user : Option < UserId > ,
521531
522532 /// Group for the daemon process
523533 #[ arg( long, value_name = "GID" ) ]
524- group : Option < GroupId > ,
534+ pub group : Option < GroupId > ,
525535 }
526536
527537 impl Args {
@@ -536,7 +546,7 @@ mod unix {
536546 /// A user ID in configuration.
537547 #[ derive( Clone , Debug , Deserialize , Serialize ) ]
538548 #[ serde( try_from = "String" , into = "String" , expecting = "a user name" ) ]
539- struct UserId {
549+ pub struct UserId {
540550 /// The user name.
541551 ///
542552 /// This is used for error reporting.
@@ -601,7 +611,7 @@ mod unix {
601611 /// A user ID in configuration.
602612 #[ derive( Clone , Debug , Deserialize , Serialize ) ]
603613 #[ serde( try_from = "String" , into = "String" , expecting = "a user name" ) ]
604- struct GroupId {
614+ pub struct GroupId {
605615 /// The group name.
606616 name : String ,
607617
0 commit comments