summaryrefslogtreecommitdiffstats
path: root/modules/ssh
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-06-03 15:36:18 +0100
committerGitHub <noreply@github.com>2022-06-03 15:36:18 +0100
commit1d04e8641d4abab6ce978bc2dc5523c2ddb2f628 (patch)
tree742564159535d13dd060074187be79616da2bb3f /modules/ssh
parent085924b1b370310c989fa5e75bb33323746382b0 (diff)
downloadgitea-1d04e8641d4abab6ce978bc2dc5523c2ddb2f628.tar.gz
gitea-1d04e8641d4abab6ce978bc2dc5523c2ddb2f628.zip
Set Setpgid on child git processes (#19865)
When Gitea is running as PID 1 git will occassionally orphan child processes leading to (defunct) processes. This PR simply sets Setpgid to true on these child processes meaning that these defunct processes will also be correctly reaped. Fix #19077 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/ssh')
-rw-r--r--modules/ssh/ssh.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index fe3561cefa..a240c01319 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -102,6 +102,8 @@ func sessionHandler(session ssh.Session) {
}
defer stdin.Close()
+ process.SetSysProcAttribute(cmd)
+
wg := &sync.WaitGroup{}
wg.Add(2)