Documentation
¶
Overview ¶
Package tasks is a port of the pattern behind lazydocker's TaskManager: one task is one goroutine plus a cancelable context, and starting a new task stops the previous one.
It only ever owns rendering/reading goroutines. Cancelling a task must never stop the underlying shell process, which keeps running in the background even when its session is not displayed.
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 runs at most one task at a time: starting a new one stops whichever was running first. It only ever owns display/reading goroutines — never anything that should keep running once nobody is watching it (that is what pkg/session's own drain goroutines are for; cancelling a task here must never reach into a session's process).
func NewManager ¶
func NewManager() *Manager
NewManager returns an empty Manager, ready to run tasks.
func (*Manager) NewTask ¶
NewTask stops the currently running task, if any, then starts f in its own goroutine with a fresh cancelable context.
func (*Manager) NewTickerTask ¶
NewTickerTask is NewTask wrapping f in a loop that also runs on every tick of interval, until stopped. f runs once immediately, then again on each tick — the same "run once, then on ticks" shape as gui.goEvery.