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 Remer
2026-08-29 19:54:07 +00:00
committed by GitHub
co-authored by wxiaoguang
parent 88974d2db9
commit eea03676d3
21 changed files with 198 additions and 203 deletions
+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()
}