MCPcopy Create free account
hub / github.com/FalconOpsLLC/goexec / ExecuteCleanMethod

Function ExecuteCleanMethod

pkg/goexec/method.go:103–131  ·  view source on GitHub ↗
(ctx context.Context, module CleanExecutionMethod, execIO *ExecutionIO)

Source from the content-addressed store, hash-verified

101}
102
103func ExecuteCleanMethod(ctx context.Context, module CleanExecutionMethod, execIO *ExecutionIO) (err error) {
104 log := zerolog.Ctx(ctx)
105
106 if err = ExecuteMethod(ctx, module, execIO); err != nil {
107 return
108 }
109
110 if err = module.Clean(ctx); err != nil {
111 log.Error().Err(err).Msg("Module cleanup failed")
112 err = nil
113 }
114
115 if execIO.Output != nil && execIO.Output.Provider != nil {
116 log.Info().Msg("Collecting output")
117
118 defer func() {
119 if cleanErr := execIO.Clean(ctx); cleanErr != nil {
120 log.Debug().Err(cleanErr).Msg("Output provider cleanup failed")
121 }
122 }()
123
124 if err := execIO.GetOutput(ctx); err != nil {
125 log.Error().Err(err).Msg("Output collection failed")
126 return fmt.Errorf("get output: %w", err)
127 }
128 log.Debug().Msg("Output collection succeeded")
129 }
130 return
131}

Callers 4

tsch.goFile · 0.92
scmr.goFile · 0.92
dcom.goFile · 0.92
wmi.goFile · 0.92

Calls 3

ExecuteMethodFunction · 0.85
CleanMethod · 0.65
GetOutputMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…