github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/process/manager_unix.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 //go:build !windows 7 8 package process 9 10 import ( 11 "os/exec" 12 "syscall" 13 ) 14 15 // SetSysProcAttribute sets the common SysProcAttrs for commands 16 func SetSysProcAttribute(cmd *exec.Cmd) { 17 // When GitBundle 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. 18 cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} 19 }