Documentation ¶
Overview ¶
Package exec runs external commands. It wraps exec.Cmd package with support for allocating a pseudo-terminal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareConsole ¶
PrepareConsole is run at the start of the application to set up the console.
Types ¶
type Cmd ¶
Cmd is a command type.
func Command ¶
Command returns the `Cmd` struct to execute the named program with the given arguments.
func (*Cmd) ForwardSignal ¶
ForwardSignal forwards a given `sig` with a delay if cmd.forwardSignalDelay is greater than 0, and if the same signal is received again, it is forwarded immediately.
func (*Cmd) RegisterGracefullyShutdown ¶
RegisterGracefullyShutdown registers a graceful shutdown for the command in two ways:
- If the context cancel contains a cause with a signal, this means that Terragrunt received the signal from the OS, since our executed command may also receive the same signal, we need to give the command time to gracefully shutting down, to avoid the command receiving this signal twice. Thus we will send the signal to the executed command with a delay or immediately if Terragrunt receives this same signal again.
- If the context does not contain any causes, this means that there was some failure and we need to terminate all executed commands, in this situation we are sure that commands did not receive any signal, so we send them an interrupt signal immediately.
func (*Cmd) SendSignal ¶
SendSignal sends the given `sig` to the executed command.
type Option ¶
type Option func(*Cmd)
Option is type for passing options to the Cmd.
func WithForwardSignalDelay ¶
WithForwardSignalDelay sets forwarding signal delay to the Cmd.