MCPcopy
hub / github.com/keploy/keploy / executeScript

Method executeScript

pkg/service/replay/replay.go:3614–3632  ·  view source on GitHub ↗
(ctx context.Context, script string)

Source from the content-addressed store, hash-verified

3612}
3613
3614func (r *Replayer) executeScript(ctx context.Context, script string) error {
3615
3616 if script == "" {
3617 return nil
3618 }
3619
3620 // Define the function to cancel the command
3621 cmdCancel := func(cmd *exec.Cmd) func() error {
3622 return func() error {
3623 return utils.InterruptProcessTree(r.logger, cmd.Process.Pid, syscall.SIGINT)
3624 }
3625 }
3626
3627 cmdErr := utils.ExecuteCommand(ctx, r.logger, script, cmdCancel, 25*time.Second, nil)
3628 if cmdErr.Err != nil {
3629 return fmt.Errorf("failed to execute script: %w", cmdErr.Err)
3630 }
3631 return nil
3632}
3633
3634func (r *Replayer) DeleteTestSet(ctx context.Context, testSetID string) error {
3635 return r.testDB.DeleteTestSet(ctx, testSetID)

Callers 1

RunTestSetMethod · 0.95

Calls 2

InterruptProcessTreeFunction · 0.92
ExecuteCommandFunction · 0.92

Tested by

no test coverage detected