Documentation
¶
Index ¶
- func ExecuteCommand(ctx context.Context, cmd *exec.Cmd) error
- func ExecuteCommandAndRelease(ctx context.Context, cmd *exec.Cmd) error
- func ExecuteCommandReturnStdout(ctx context.Context, cmd *exec.Cmd) (output string, err error)
- func Restart(ctx context.Context, logger chassis.Logger)
- func Shutdown(ctx context.Context, logger chassis.Logger)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteCommand ¶ added in v0.0.6
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
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
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.
Types ¶
This section is empty.