process

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package process provides native OS process management: starting processes, capturing their output, and stopping them gracefully. It is the foundation for the local-execution app launchers (Phase 3).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager starts and tracks native OS processes.

func NewManager

func NewManager(logger *zap.Logger) *Manager

NewManager creates a new process Manager.

func (*Manager) GetOutput

func (m *Manager) GetOutput(pid int) ([]string, error)

GetOutput returns the captured output lines for the tracked process.

func (*Manager) IsRunning

func (m *Manager) IsRunning(pid int) bool

IsRunning reports whether the tracked process with the given PID is running.

func (*Manager) Kill

func (m *Manager) Kill(pid int) error

Kill terminates a process immediately with SIGKILL.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, opts StartOptions) (*Process, error)

Start launches a process and begins capturing its output. The returned Process is tracked by the Manager and can be referenced later by its PID.

func (*Manager) Stop

func (m *Manager) Stop(pid int, timeout time.Duration) error

Stop gracefully terminates a process: it sends SIGTERM and, if the process has not exited within timeout, escalates to SIGKILL.

type Process

type Process struct {
	PID       int
	StartTime time.Time
	// contains filtered or unexported fields
}

Process represents a managed OS process and its captured output.

func (*Process) ExitError

func (p *Process) ExitError() error

ExitError returns the error from the process exit, if any. It is nil while the process is still running or if it exited successfully.

func (*Process) IsRunning

func (p *Process) IsRunning() bool

IsRunning reports whether the process has not yet exited.

func (*Process) Output

func (p *Process) Output() []string

Output returns the lines captured from stdout and stderr so far.

type StartOptions

type StartOptions struct {
	Command string
	Args    []string
	Env     map[string]string
	WorkDir string
}

StartOptions describes a process to launch.

Jump to

Keyboard shortcuts

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