From 648de844fb0dc26c4eb59252184d58684acc167d Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Thu, 10 Nov 2022 13:12:50 -0600 Subject: [PATCH] Address a race condition uncovered when adding test condition. Signed-off-by: Nick Freyaldenhoven --- pkg/action/install.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index d5c34cef7..563d2fc8a 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -422,7 +422,10 @@ func (i *Install) performInstall(c chan<- resultMessage, rel *release.Release, t } if !i.DisableHooks { - if err := i.cfg.execHook(rel, release.HookPostInstall, i.Timeout); err != nil { + i.Lock.Lock() + err := i.cfg.execHook(rel, release.HookPostInstall, i.Timeout) + i.Lock.Unlock() + if err != nil { i.reportToRun(c, rel, fmt.Errorf("failed post-install: %s", err)) return }