process

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUserCommand

func BuildUserCommand(ctx context.Context, userCmd []string) (*exec.Cmd, error)

BuildUserCommand will return a exec.Cmd for the user command of the process. This is used when the process for a container is wrapped and meant to perform tasks before or after the user command runs.

func CancelContextSigterm

func CancelContextSigterm(ctx context.Context) (context.Context, func())

func CloseAndLog

func CloseAndLog(ctx context.Context, c io.Closer)

CloseAndLog is a utility function that closes a resource and logs any error that occurs. It should be used for defers to ensure that the resource is closed properly and any errors are logged.

func CloseIgnoreAndLog

func CloseIgnoreAndLog[I any](ctx context.Context, c CloserIgnore[I])

CloseIgnoreAndLog is a utility function that closes a resource and logs any error that occurs, and ignores the result. It should be used for defers to ensure that the resource is closed properly and any errors are logged.

func CopyFile

func CopyFile(ctx context.Context, src, dst string) error

func HookCommand

func HookCommand(ctx context.Context, cmd *exec.Cmd, preStart, postStop Hook) (int, error)

HookCommand provides a pre-start and post-stop hooks for a exec.Cmd. It will execute the pre-start hook, then execute the command as a subprocess, then run the post-stop hook. If there are errors with pre/post hooks, they are logged but the subprocess is still run.

func RemovePathAndLog

func RemovePathAndLog(ctx context.Context, path string)

Types

type CloserIgnore

type CloserIgnore[I any] interface {
	Close() (I, error)
}

type Hook

type Hook = func(context.Context, *exec.Cmd) error

Hook represents the

Jump to

Keyboard shortcuts

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