Documentation
¶
Index ¶
- func ConfigureChildProcessGroup(cmd *exec.Cmd)
- func DefaultRoot(env map[string]string) string
- func TerminateProcess(pid int) error
- type Manager
- func (manager *Manager) Get(taskID string) (Task, bool)
- func (manager *Manager) Kill(taskID string) error
- func (manager *Manager) KillRunning() error
- func (manager *Manager) List() []Task
- func (manager *Manager) ListByParent(parentID string) []Task
- func (manager *Manager) LoadWarnings() []string
- func (manager *Manager) MarkExited(taskID string, status Status, exitCode int) error
- func (manager *Manager) OutputPath(taskID string) string
- func (manager *Manager) Register(input RegisterInput) (string, error)
- func (manager *Manager) RootDir() string
- func (manager *Manager) SetPID(taskID string, pid int) error
- func (manager *Manager) UpdateStatus(taskID string, status Status, exitCode int) error
- type ManagerOptions
- type RegisterInput
- type Status
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureChildProcessGroup ¶
ConfigureChildProcessGroup puts a child into its own process group so the whole group can be signalled as a unit. terminateProcess depends on this: it signals the negative PID (the group), so any process the child forks dies with it instead of being orphaned. Must be called before cmd.Start.
func DefaultRoot ¶
func TerminateProcess ¶
TerminateProcess stops a background process by PID — on Windows its process tree; on POSIX its whole process group when the PID leads its own group (the invariant ConfigureChildProcessGroup establishes for processes started through this package), otherwise just the individual PID. The PID-only fallback is deliberate — signalling a non-leader's group could hit unrelated processes — but it means descendants of a non-leader are NOT reaped; pass a group leader to guarantee group termination. Exported for callers that hold a raw PID and cannot route through the manager, e.g. cleaning up a just-launched child whose PID could not be recorded.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManagerWithOptions ¶
func NewManagerWithOptions(options ManagerOptions) (*Manager, error)
func (*Manager) KillRunning ¶
func (*Manager) ListByParent ¶
func (*Manager) LoadWarnings ¶
func (*Manager) MarkExited ¶
func (*Manager) OutputPath ¶
type ManagerOptions ¶
type RegisterInput ¶
type Task ¶
type Task struct {
ID string `json:"id"`
Type string `json:"type"`
SpecialistName string `json:"specialistName,omitempty"`
Description string `json:"description,omitempty"`
ParentID string `json:"parentId,omitempty"`
PID int `json:"pid,omitempty"`
Status Status `json:"status"`
OutputFile string `json:"outputFile"`
StartedAt time.Time `json:"startedAt"`
CompletedAt time.Time `json:"completedAt,omitempty"`
ExitCode int `json:"exitCode,omitempty"`
}