process

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillProcessGroup added in v0.0.6

func KillProcessGroup(leaderPID int, opts KillOptions) error

KillProcessGroup sends SIGTERM to a process group, waits for the grace period, then sends SIGKILL if processes are still running. The leaderPID parameter is the process ID of the group leader.

func SetProcessGroup added in v0.0.6

func SetProcessGroup(cmd *exec.Cmd)

SetProcessGroup configures a command to run in its own process group.

Types

type EnvBuilder

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

EnvBuilder builds environment variables for script execution

func NewEnvBuilder

func NewEnvBuilder(ports *PortAllocator) *EnvBuilder

NewEnvBuilder creates a new environment builder

func (*EnvBuilder) BuildEnv

func (b *EnvBuilder) BuildEnv(ws *data.Workspace) []string

BuildEnv creates environment variables for a workspace

func (*EnvBuilder) BuildEnvMap

func (b *EnvBuilder) BuildEnvMap(ws *data.Workspace) map[string]string

BuildEnvMap creates a map of environment variables

type KillOptions added in v0.0.6

type KillOptions struct {
	// GracePeriod is how long to wait for SIGTERM before sending SIGKILL.
	// Default: 200ms
	GracePeriod time.Duration
}

KillOptions configures process group termination behavior.

type PortAllocator

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

PortAllocator manages port allocation for workspaces

func NewPortAllocator

func NewPortAllocator(start, rangeSize int) *PortAllocator

NewPortAllocator creates a new port allocator

func (*PortAllocator) AllocatePort

func (p *PortAllocator) AllocatePort(workspaceRoot string) int

AllocatePort allocates a port range for a workspace

func (*PortAllocator) GetPort

func (p *PortAllocator) GetPort(workspaceRoot string) (int, bool)

GetPort returns the allocated port for a workspace

func (*PortAllocator) PortRange

func (p *PortAllocator) PortRange(workspaceRoot string) (port int, rangeEnd int)

PortRange returns the port and range size for a workspace

func (*PortAllocator) ReleasePort

func (p *PortAllocator) ReleasePort(workspaceRoot string)

ReleasePort releases the port allocation for a workspace

type ScriptRunner

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

ScriptRunner manages script execution for workspaces

func NewScriptRunner

func NewScriptRunner(portStart, portRange int) *ScriptRunner

NewScriptRunner creates a new script runner

func (*ScriptRunner) IsRunning

func (r *ScriptRunner) IsRunning(ws *data.Workspace) bool

IsRunning checks if a script is running for a workspace

func (*ScriptRunner) LoadConfig

func (r *ScriptRunner) LoadConfig(repoPath string) (*WorkspaceConfig, error)

LoadConfig loads the workspace configuration from the repo

func (*ScriptRunner) RunScript

func (r *ScriptRunner) RunScript(ws *data.Workspace, scriptType ScriptType) (*exec.Cmd, error)

RunScript runs a script for a workspace

func (*ScriptRunner) RunSetup

func (r *ScriptRunner) RunSetup(ws *data.Workspace) error

RunSetup runs the setup scripts for a workspace

func (*ScriptRunner) Stop

func (r *ScriptRunner) Stop(ws *data.Workspace) error

Stop stops the running script for a workspace

func (*ScriptRunner) StopAll

func (r *ScriptRunner) StopAll()

StopAll stops all running scripts

type ScriptType

type ScriptType string

ScriptType identifies the type of script

const (
	ScriptSetup   ScriptType = "setup"
	ScriptRun     ScriptType = "run"
	ScriptArchive ScriptType = "archive"
)

type WorkspaceConfig added in v0.0.5

type WorkspaceConfig struct {
	SetupWorkspace []string `json:"setup-workspace"`
	RunScript      string   `json:"run"`
	ArchiveScript  string   `json:"archive"`
}

WorkspaceConfig holds per-project workspace configuration

Jump to

Keyboard shortcuts

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