diff --git a/service.go b/service.go index a545062..cd4326a 100644 --- a/service.go +++ b/service.go @@ -70,12 +70,14 @@ import ( ) const ( - optionKeepAlive = "KeepAlive" - optionKeepAliveDefault = true - optionRunAtLoad = "RunAtLoad" - optionRunAtLoadDefault = false - optionUserService = "UserService" - optionUserServiceDefault = false + optionKeepAlive = "KeepAlive" + optionKeepAliveDefault = true + optionRunAtLoad = "RunAtLoad" + optionRunAtLoadDefault = false + optionUserService = "UserService" + optionUserServiceDefault = false + optionSessionCreate = "SessionCreate" + optionSessionCreateDefault = false ) // Config provides the setup for a Service. The Name field is required. diff --git a/service_darwin.go b/service_darwin.go index fa87023..7386c0f 100644 --- a/service_darwin.go +++ b/service_darwin.go @@ -5,6 +5,7 @@ package service import ( + "errors" "fmt" "os" "os/signal" @@ -13,7 +14,6 @@ import ( "syscall" "text/template" "time" - "errors" ) const maxPathSize = 32 * 1024 @@ -134,11 +134,13 @@ func (s *darwinLaunchdService) Install() error { Path string KeepAlive, RunAtLoad bool + SessionCreate bool }{ - Config: s.Config, - Path: path, - KeepAlive: s.Option.bool(optionKeepAlive, optionKeepAliveDefault), - RunAtLoad: s.Option.bool(optionRunAtLoad, optionRunAtLoadDefault), + Config: s.Config, + Path: path, + KeepAlive: s.Option.bool(optionKeepAlive, optionKeepAliveDefault), + RunAtLoad: s.Option.bool(optionRunAtLoad, optionRunAtLoadDefault), + SessionCreate: s.Option.bool(optionSessionCreate, optionSessionCreateDefault), } functions := template.FuncMap{ @@ -229,6 +231,7 @@ var launchdConfig = ` {{if .UserName}}UserName{{html .UserName}}{{end}} {{if .ChRoot}}RootDirectory{{html .ChRoot}}{{end}} {{if .WorkingDirectory}}WorkingDirectory{{html .WorkingDirectory}}{{end}} +SessionCreate<{{bool .SessionCreate}}/> KeepAlive<{{bool .KeepAlive}}/> RunAtLoad<{{bool .RunAtLoad}}/> Disabled