Documentation ¶
Overview ¶
Package extcmd supports use cases in which a command is supposed be started non-blocking as a result of an incoming HTTP requests, e.g., ActionKit's start call. It allows retrieval of log messages for streaming to the agent as well as stopping and status access.
This package maintains state through a global variable that is a mapping from a random ID to CmdState. The random ID is contained within CmdState.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveCmdState ¶
func RemoveCmdState(id string)
RemoveCmdState removes the state with the given ID. A no-op in case there is no state with this ID. It is the caller's responsibility to ensure that the exec.Cmd itself is stopped.
Types ¶
type CmdState ¶
func GetCmdState ¶
GetCmdState returns the state stored under the given ID or an error in case there is no persisted state under the ID.
func NewCmdState ¶
NewCmdState create a new CmdState and registers it as a global state. The expected call pattern is that NewCmdState is called immediately after the exec.Cmd is created, but before the Cmd is started.