MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeSetPpid

Method executeSetPpid

workflow/executor_config.go:140–161  ·  view source on GitHub ↗

executeSetPpid sets the parent process ID for the specified beacon

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

138
139// executeSetPpid sets the parent process ID for the specified beacon
140func (e *Executor) executeSetPpid(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
141 ppidVal, ok := action.Parameters["ppid"]
142 if !ok {
143 return "", fmt.Errorf("ppid parameter required for set_ppid")
144 }
145
146 var ppid int
147 switch v := ppidVal.(type) {
148 case float64:
149 ppid = int(v)
150 case int:
151 ppid = v
152 default:
153 return "", fmt.Errorf("ppid parameter must be a number")
154 }
155
156 resp, err := client.SetPpid(ctx, beaconID, ppid)
157 if err != nil {
158 return "", err
159 }
160 return e.fireAndForget(resp.TaskID, fmt.Sprintf("set ppid %d", ppid))
161}
162
163// executeUnsetPpid unsets the parent process ID for the specified beacon
164func (e *Executor) executeUnsetPpid(ctx context.Context, client *csclient.Client, beaconID string) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

fireAndForgetMethod · 0.95

Tested by

no test coverage detected