-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_handler.go
32 lines (28 loc) · 1.06 KB
/
event_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package exec
// EventHandler bind event hanlder to do logging or other handling as you want
// be careful that all event handler function will be triggered synchronously to provide you synchronously control.
// use `go func()` inside handler for asynchronously control
type EventHandler struct {
// trigger when cmd successfully started
CmdStarted CmdEvent
// trigger when cmd get any output ( error will trigger CmdFailed )
CmdRead CmdEvent
// trigger when cmd be canceled
CmdCanceled CmdEvent
// trigger when cmd failed which means process throw error
CmdFailed CmdEvent
// trigger when cmd done without any error
CmdDone CmdEvent
// trigger when pipeline successfully started
PipelineStarted PipelineEvent
// trigger when pipeline be canceled
PipelineCanceled PipelineEvent
// trigger when pipeline failed
PipelineFailed PipelineEvent
// trigger when pipeline done without any error
PipelineDone PipelineEvent
}
// CmdEvent cmd event handle func
type CmdEvent func(cmd *Cmd)
// PipelineEvent pipeline event handle func
type PipelineEvent func(pipe *Pipeline)