procgroup

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package procgroup stops the process groups that steps leave running in the background once the workflow that started them is over.

Index

Constants

View Source
const StopGrace = 3 * time.Second

StopGrace is how long a background process is given to exit on SIGTERM before it is killed.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

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

Tracker records the processes that steps start in the background, so that they can be stopped when the workflow is over. An action runs in a plugin process that exits as soon as the step is done, and the background process is put in a session of its own to survive that, so nothing else would ever stop it. A nil Tracker records nothing.

func NewTracker

func NewTracker() *Tracker

NewTracker returns a Tracker with nothing recorded.

func (*Tracker) Begin

func (b *Tracker) Begin() func()

Begin is called before an action that can start a background process runs, and the function it returns once the action has returned and its process, if any, has been tracked. Stop waits a moment for such actions to report.

func (*Tracker) Stop

func (b *Tracker) Stop()

Stop terminates every recorded process and removes its log file.

func (*Tracker) StopOnSignal

func (b *Tracker) StopOnSignal() func()

StopOnSignal stops the recorded processes when probe is interrupted, terminated or hung up on, and then lets the signal end probe as it would have. The background processes are in sessions of their own, so the signal never reaches them, and nothing else would stop them. The first signal restores the default handling, so a second one ends probe at once. The returned function ends the watch.

func (*Tracker) Track

func (b *Tracker) Track(pid int, log string)

Track records a process group a step started in the background, led by pid, and the file its output goes to, which is removed along with it. An empty log has no file to remove.

Jump to

Keyboard shortcuts

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