You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

manager_unix.go 525B

1234567891011121314151617
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. //go:build !windows
  4. package process
  5. import (
  6. "os/exec"
  7. "syscall"
  8. )
  9. // SetSysProcAttribute sets the common SysProcAttrs for commands
  10. func SetSysProcAttribute(cmd *exec.Cmd) {
  11. // 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.
  12. cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
  13. }