summaryrefslogtreecommitdiffstats
path: root/modules/process/manager_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/process/manager_unix.go')
-rw-r--r--modules/process/manager_unix.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/process/manager_unix.go b/modules/process/manager_unix.go
new file mode 100644
index 0000000..c5be906
--- /dev/null
+++ b/modules/process/manager_unix.go
@@ -0,0 +1,17 @@
+// Copyright 2022 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+//go:build !windows
+
+package process
+
+import (
+ "os/exec"
+ "syscall"
+)
+
+// SetSysProcAttribute sets the common SysProcAttrs for commands
+func SetSysProcAttribute(cmd *exec.Cmd) {
+ // When Gitea runs SubProcessA -> SubProcessB and SubProcessA gets killed by context timeout, use setpgid to make sure the sub processes can be reaped instead of leaving defunct(zombie) processes.
+ cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
+}