windows

package
v0.75.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package windows provides a set of functions to manage Windows services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceManager

type ServiceManager interface {
	StopAllAgentServices(ctx context.Context) error
	StartAgentServices(ctx context.Context) error
	RestartAgentServices(ctx context.Context) error
}

ServiceManager interface abstracts all service management operations

Could generalize for arbitrary services later, but we only need the Agent services for now.

type WinServiceManager

type WinServiceManager struct {
	// contains filtered or unexported fields
}

WinServiceManager implements ServiceManager using the SystemAPI interface

func NewWinServiceManager

func NewWinServiceManager() *WinServiceManager

NewWinServiceManager creates a new WinServiceManager with real implementations

func NewWinServiceManagerWithAPI

func NewWinServiceManagerWithAPI(api systemAPI) *WinServiceManager

NewWinServiceManagerWithAPI creates a new WinServiceManager with a custom SystemAPI (for testing)

func (*WinServiceManager) RestartAgentServices

func (w *WinServiceManager) RestartAgentServices(ctx context.Context) (err error)

RestartAgentServices combines StopAllAgentServices and StartAgentServices.

Ignores errors from StopAllAgentServices and will always attempt to start the services again. Returns an error if any of the services failed to start.

func (*WinServiceManager) StartAgentServices

func (w *WinServiceManager) StartAgentServices(ctx context.Context) (err error)

StartAgentServices starts the Agent service, expecting it to start all other services as well.

func (*WinServiceManager) StopAllAgentServices

func (w *WinServiceManager) StopAllAgentServices(ctx context.Context) (err error)

StopAllAgentServices stops the Agent service, expecting it to stop all other services as well. After attempting to stop the Agent service, it will force stop any remaining services.

Returns nil if the Agent service does not exist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL