(ctx context.Context, id, method string, fn func() pluginapi.Plugin)
| 624 | } |
| 625 | |
| 626 | func (h *Host) safePluginCall(ctx context.Context, id, method string, fn func() pluginapi.Plugin) (out pluginapi.Plugin, ok bool) { |
| 627 | defer func() { |
| 628 | if recovered := recover(); recovered != nil { |
| 629 | h.fusePlugin(id, method, recovered) |
| 630 | out = pluginapi.Plugin{} |
| 631 | ok = false |
| 632 | } |
| 633 | }() |
| 634 | |
| 635 | if ctx != nil { |
| 636 | select { |
| 637 | case <-ctx.Done(): |
| 638 | return pluginapi.Plugin{}, false |
| 639 | default: |
| 640 | } |
| 641 | } |
| 642 | return fn(), true |
| 643 | } |
| 644 | |
| 645 | func validPlugin(plugin pluginapi.Plugin) bool { |
| 646 | if strings.TrimSpace(plugin.Metadata.Name) == "" { |
no test coverage detected