fix(process): reap entire process group on cmd.Cancel (#39143)

Signed-off-by: Royce Remer <royceremer@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Royce Remerandwxiaoguang authored and GitHub committed 2026-08-29 19:54:07 +00:00
1 parent 88974d2db9
commit eea03676d3
21 files changed
+198 -203

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package process
import "os/exec"
// There is no graceful way to kill a process on Windows at the moment
func setSysProcAttribute(cmd *exec.Cmd) {}
func (c *Cmd) onCancel() error {
if c.onCancelUserFunc != nil {
if err := c.onCancelUserFunc(); err != nil {
return err
}
}
return c.Process.Kill()
}