Documentation
¶
Overview ¶
Package cmd contains helpers that abstract away the chore of starting new processes, tracking their lifetime, inspecting their output, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunCommand ¶
func RunCommand(ctx context.Context, path string, args []string, pf func(string) bool) (bool, error)
RunCommand starts a new process and waits until either its completion, or until the supplied predicate function pf returns true. The function is called for each line produced by the new process.
The returned boolean value equals the last value returned by pf.
The process will be killed both in the event the context is cancelled, and when expectedOutput is found.
func TerminateIfFound ¶
TerminateIfFound creates RunCommand predicates that instantly terminate program execution in the event the given string is found in any line produced. RunCommand will return true, if the string searched for was found, and false otherwise. If logf isn't nil, it will be called whenever a new line is received.
func WaitUntilCompletion ¶
WaitUntilCompletion creates a RunCommand predicate that will make it wait for the process to exit on its own. If logf isn't nil, it will be called whenever a new line is received.
Types ¶
This section is empty.