service

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BrewLabel = "homebrew.mxcl.quacktel"

BrewLabel is the launchd label brew services gives the formula's service.

View Source
const DefaultLabel = "dev.quacktel.serve"

DefaultLabel is the launchd label of the real agent.

Variables

This section is empty.

Functions

func DefaultRunner

func DefaultRunner(ctx context.Context, args ...string) ([]byte, error)

DefaultRunner runs the real launchctl.

func Render

func Render(p Plist) ([]byte, error)

Render encodes p through encoding/xml so no argument can break out of its element.

Types

type Manager

type Manager struct {
	Label  string
	Home   string
	UID    int
	Run    Runner
	Logger *slog.Logger
	// contains filtered or unexported fields
}

Manager controls one launchd agent in the user's GUI domain.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, args []string) error

Install writes the plist for args and (re)loads the agent.

func (*Manager) LogDir

func (m *Manager) LogDir() string

LogDir holds both quacktel's own log file and launchd's capture of stdout and stderr.

func (*Manager) PlistPath

func (m *Manager) PlistPath() string

func (*Manager) Restart

func (m *Manager) Restart(ctx context.Context) error

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) (Status, error)

func (*Manager) Uninstall

func (m *Manager) Uninstall(ctx context.Context) error

Uninstall unloads the agent and removes its plist.

type Plist

type Plist struct {
	Label            string
	ProgramArguments []string
	// LogPath receives launchd's own stdout and stderr for the job.
	LogPath string
}

Plist is the subset of a launchd job definition that quacktel writes.

func ReadPlist

func ReadPlist(path string) (Plist, error)

ReadPlist parses a plist written by Render.

type Runner

type Runner func(ctx context.Context, args ...string) ([]byte, error)

Runner runs launchctl with args and returns its combined output.

type Status

type Status struct {
	Loaded   bool
	State    string
	PID      int
	LastExit *int
	Args     []string
}

Status is what launchctl reports for the agent.

Jump to

Keyboard shortcuts

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