summaryrefslogtreecommitdiffstats
path: root/modules/ssh
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-06-30 21:07:23 +0100
committerGitHub <noreply@github.com>2021-06-30 22:07:23 +0200
commit302e8b6d02dc9ccac00284b3cdf9a69c001882c0 (patch)
treefd8a57a78924df719b8c6771d59c6577b163b659 /modules/ssh
parent365c4e9316bbcc8bdf9cf68ef237bf18ae8db315 (diff)
downloadgitea-302e8b6d02dc9ccac00284b3cdf9a69c001882c0.tar.gz
gitea-302e8b6d02dc9ccac00284b3cdf9a69c001882c0.zip
Prevent zombie processes (#16314)
Unfortunately go doesn't always ensure that execd processes are completely waited for. On linux this means that zombie processes can occur. This PR ensures that these are waited for by using signal notifier in serv and passing a context elsewhere. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/ssh')
-rw-r--r--modules/ssh/ssh.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index bcaae5a180..c0897377c5 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -66,7 +66,7 @@ func sessionHandler(session ssh.Session) {
args := []string{"serv", "key-" + keyID, "--config=" + setting.CustomConf}
log.Trace("SSH: Arguments: %v", args)
- cmd := exec.Command(setting.AppPath, args...)
+ cmd := exec.CommandContext(session.Context(), setting.AppPath, args...)
cmd.Env = append(
os.Environ(),
"SSH_ORIGINAL_COMMAND="+command,