cmd

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cmd same as exec module but with zombie processes reaper support.

Package cmd same as exec module but with reaper support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder added in v0.2.0

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

func New

func New(name string, arg ...string) Builder

Returns new command builder, which can be runned via Run() method

func (Builder) Run added in v0.2.0

func (c Builder) Run() (result *RunResult, err error)

Run executes a command with context, awaits completion and returnes result

func (Builder) WithContext added in v0.2.0

func (c Builder) WithContext(ctx context.Context) Builder

WithContext returns new Builder with context, which will be applied to command execution

func (Builder) WithEnv added in v0.2.0

func (c Builder) WithEnv(envMap map[string]string) Builder

WithEnv returns new Builder with added environment variables for command Added variables override existing env values with same name

type ProcessInfo

type ProcessInfo struct {
	Pid    int
	Status syscall.WaitStatus
}

type ProcessState

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

ProcessState stores information about a process, as reported by Wait.

func (*ProcessState) ExitCode

func (p *ProcessState) ExitCode() int

ExitCode returns the exit code of the exited process, or -1 if the process hasn't exited or was terminated by a signal.

func (*ProcessState) Exited

func (p *ProcessState) Exited() bool

func (*ProcessState) Pid

func (p *ProcessState) Pid() int

Pid returns the process id of the exited process.

func (*ProcessState) String

func (p *ProcessState) String() string

func (*ProcessState) Success

func (p *ProcessState) Success() bool

type RunResult added in v0.2.0

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

func (*RunResult) State added in v0.2.0

func (c *RunResult) State() *ProcessState

func (*RunResult) Stderr added in v0.2.0

func (c *RunResult) Stderr() []byte

func (*RunResult) Stdout added in v0.2.0

func (c *RunResult) Stdout() []byte

type ZombieProcessReaper

type ZombieProcessReaper struct {
}

func (*ZombieProcessReaper) Start

func (r *ZombieProcessReaper) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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