Documentation
¶
Index ¶
- func BuildUserCommand(ctx context.Context, userCmd []string) (*exec.Cmd, error)
- func CancelContextSigterm(ctx context.Context) (context.Context, func())
- func CloseAndLog(ctx context.Context, c io.Closer)
- func CloseIgnoreAndLog[I any](ctx context.Context, c CloserIgnore[I])
- func CopyFile(ctx context.Context, src, dst string) error
- func HookCommand(ctx context.Context, cmd *exec.Cmd, preStart, postStop Hook) (int, error)
- func RemovePathAndLog(ctx context.Context, path string)
- type CloserIgnore
- type Hook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildUserCommand ¶
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 CloseAndLog ¶
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 HookCommand ¶
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.