MCPcopy
hub / github.com/tuna/tunasync / newExecPostHook

Function newExecPostHook

worker/exec_post_hook.go:28–45  ·  view source on GitHub ↗
(provider mirrorProvider, execOn uint8, command string)

Source from the content-addressed store, hash-verified

26}
27
28func newExecPostHook(provider mirrorProvider, execOn uint8, command string) (*execPostHook, error) {
29 cmd, err := shlex.Split(command, true)
30 if err != nil {
31 // logger.Errorf("Failed to create exec-post-hook for command: %s", command)
32 return nil, err
33 }
34 if execOn != execOnSuccess && execOn != execOnFailure {
35 return nil, fmt.Errorf("Invalid option for exec-on: %d", execOn)
36 }
37
38 return &execPostHook{
39 emptyHook: emptyHook{
40 provider: provider,
41 },
42 execOn: execOn,
43 command: cmd,
44 }, nil
45}
46
47func (h *execPostHook) postSuccess() error {
48 if h.execOn == execOnSuccess {

Callers 3

newMirrorProviderFunction · 0.85
TestExecPostFunction · 0.85
TestMirrorJobFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by 2

TestExecPostFunction · 0.68
TestMirrorJobFunction · 0.68