allow inteactive setting mode for windows (#253)
Co-authored-by: Aram <aram.petrosyan@unity3d.com> Co-authored-by: Daniel Theophanes <kardianos@gmail.com>
This commit is contained in:
@@ -190,6 +190,7 @@ func New(i Interface, c *Config) (Service, error) {
|
||||
// * Windows
|
||||
// - DelayedAutoStart bool (false) - After booting, start this service after some delay.
|
||||
// - Password string () - Password to use when interfacing with the system service manager.
|
||||
// - Interactive bool (false) - The service can interact with the desktop. (more information https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)
|
||||
type KeyValue map[string]interface{}
|
||||
|
||||
// bool returns the value of the given name, assuming the value is a boolean.
|
||||
|
||||
@@ -220,6 +220,12 @@ func (ws *windowsService) Install() error {
|
||||
s.Close()
|
||||
return fmt.Errorf("service %s already exists", ws.Name)
|
||||
}
|
||||
|
||||
serviceType := windows.SERVICE_WIN32_OWN_PROCESS
|
||||
if ws.Option.bool("Interactive") {
|
||||
serviceType = serviceType | windows.SERVICE_INTERACTIVE_PROCESS
|
||||
}
|
||||
|
||||
s, err = m.CreateService(ws.Name, exepath, mgr.Config{
|
||||
DisplayName: ws.DisplayName,
|
||||
Description: ws.Description,
|
||||
@@ -228,6 +234,7 @@ func (ws *windowsService) Install() error {
|
||||
Password: ws.Option.string("Password", ""),
|
||||
Dependencies: ws.Dependencies,
|
||||
DelayedAutoStart: ws.Option.bool("DelayedAutoStart", false),
|
||||
ServiceType: serviceType,
|
||||
}, ws.Arguments...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user