Documentation
¶
Index ¶
- func KillProcessGroup(leaderPID int, opts KillOptions) error
- func SetProcessGroup(cmd *exec.Cmd)
- type EnvBuilder
- type KillOptions
- type PortAllocator
- type ScriptRunner
- func (r *ScriptRunner) IsRunning(ws *data.Workspace) bool
- func (r *ScriptRunner) LoadConfig(repoPath string) (*WorkspaceConfig, error)
- func (r *ScriptRunner) RunScript(ws *data.Workspace, meta *data.Metadata, scriptType ScriptType) (*exec.Cmd, error)
- func (r *ScriptRunner) RunSetup(ws *data.Workspace, meta *data.Metadata) error
- func (r *ScriptRunner) Stop(ws *data.Workspace) error
- func (r *ScriptRunner) StopAll()
- type ScriptType
- type WorkspaceConfig
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
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) BuildEnvMap ¶
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, meta *data.Metadata, scriptType ScriptType) (*exec.Cmd, error)
RunScript runs a script for a workspace
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