summaryrefslogtreecommitdiffstats
path: root/plugin/supervisor.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/supervisor.go')
-rw-r--r--plugin/supervisor.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugin/supervisor.go b/plugin/supervisor.go
index f6264f47c..33243e9cf 100644
--- a/plugin/supervisor.go
+++ b/plugin/supervisor.go
@@ -23,8 +23,13 @@ type supervisor struct {
implemented [TotalHooksId]bool
}
-func newSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiImpl API) (*supervisor, error) {
+func newSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiImpl API) (retSupervisor *supervisor, retErr error) {
supervisor := supervisor{}
+ defer func() {
+ if retErr != nil {
+ supervisor.Shutdown()
+ }
+ }()
wrappedLogger := pluginInfo.WrapLogger(parentLogger)
@@ -90,7 +95,9 @@ func newSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiI
}
func (sup *supervisor) Shutdown() {
- sup.client.Kill()
+ if sup.client != nil {
+ sup.client.Kill()
+ }
}
func (sup *supervisor) Hooks() Hooks {