forgejo_a_10.0.1/modules/process/manager_unix.go
David Rotermund 3ce683f79b
Some checks failed
Integration tests for the release process / release-simulation (push) Has been cancelled
Init
2025-02-23 03:12:21 +01:00

17 lines
525 B
Go

// 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}
}