From 80a299d307bd3135eb3fb2f5e2deba600f0698ae Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Thu, 17 Dec 2020 11:50:21 +0000
Subject: [PATCH] Always wait for the cmd to finish (#14006)

After cancelling the context we still need to wait for the
command to finish otherwise zombie processes may occur

Fix #13987

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: 6543 <6543@obermui.de>
---
 modules/git/command.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/git/command.go b/modules/git/command.go
index d40c0bfa23..c9d1732416 100644
--- a/modules/git/command.go
+++ b/modules/git/command.go
@@ -153,6 +153,7 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time.
 		err := fn(ctx, cancel)
 		if err != nil {
 			cancel()
+			_ = cmd.Wait()
 			return err
 		}
 	}