launcher

package module
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoParent = fmt.Errorf("running without parent launcher process")

ErrNoParent is returned if the current process has no parent (it's ppid equals 1)

Functions

func ExitCode added in v0.2.0

func ExitCode(err error) int

func RequestRestart

func RequestRestart() error

RequestRestart sends a SIGUSR1 signal to the parent launcher process causing it to restart controlled child process. Returns ErrNoParent if there is no parent.

Types

type Launcher

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

func New added in v0.3.1

func New(opt ...Opt) *Launcher

func (*Launcher) Launch added in v0.3.1

func (launcher *Launcher) Launch(ctx context.Context, binPath string, args ...string) error

type Opt added in v0.3.1

type Opt func(*Opts)

func WithInterruptSignal added in v0.3.1

func WithInterruptSignal(signal os.Signal) Opt

func WithInterruptTimeout added in v0.3.1

func WithInterruptTimeout(timeout time.Duration) Opt

func WithWaitGroup added in v0.3.1

func WithWaitGroup(wg *sync.WaitGroup) Opt

type Opts

type Opts struct {
	InterruptSignal  os.Signal
	InterruptTimeout time.Duration
	WaitGroup        *sync.WaitGroup
}

type RuntimeError

type RuntimeError struct {
	ExitCode int
}

RuntimeError wraps error exit code from the child process

func (RuntimeError) Error

func (r RuntimeError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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