execute

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCommand added in v0.0.6

func ExecuteCommand(ctx context.Context, cmd *exec.Cmd) error

ExecuteCommand executes a command and and prints the output to stdout. It will not return until the command has completed or the context is cancelled.

NOTE: If you want the command to continue even if the parent is killed (e.g. through a signal like SIGINT) you will want to launch the command in a new process group so that signals are not sent to the child process.

cmd.SysProcAttr = &syscall.SysProcAttr{
	Setpgid: true,
}

func ExecuteCommandAndRelease added in v0.0.19

func ExecuteCommandAndRelease(ctx context.Context, cmd *exec.Cmd) error

ExecuteCommandAndRelease will execute the given command and release all associated resources so that it will continue to run even if the caller is terminated.

NOTE: You probably want to launch the command in a new process group to avoid signals (e.g. SIGINT) being sent to the child process.

cmd.SysProcAttr = &syscall.SysProcAttr{
	Setpgid: true,
}

func ExecuteCommandReturnStdout added in v0.0.6

func ExecuteCommandReturnStdout(ctx context.Context, cmd *exec.Cmd) (output string, err error)

ExecuteCommandReturnStdout executes a command and returns the output of stdout as a string. It does not print the output to the console. This can be used to get the output of a command. It will not return until the command has completed or the context is cancelled.

func Restart added in v0.0.37

func Restart(ctx context.Context, logger chassis.Logger)

func Shutdown added in v0.0.37

func Shutdown(ctx context.Context, logger chassis.Logger)

Types

This section is empty.

Jump to

Keyboard shortcuts

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