mirror of
https://github.com/mudler/luet.git
synced 2025-09-06 17:50:34 +00:00
Update gomod and vendor
This commit is contained in:
35
vendor/github.com/moby/buildkit/source/git/gitsource_unix.go
generated
vendored
Normal file
35
vendor/github.com/moby/buildkit/source/git/gitsource_unix.go
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// +build !windows
|
||||
|
||||
package git
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func runProcessGroup(ctx context.Context, cmd *exec.Cmd) error {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
if err := cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
waitDone := make(chan struct{})
|
||||
go func() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
syscall.Kill(-cmd.Process.Pid, syscall.SIGTERM)
|
||||
go func() {
|
||||
select {
|
||||
case <-waitDone:
|
||||
case <-time.After(10 * time.Second):
|
||||
syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
||||
}
|
||||
}()
|
||||
case <-waitDone:
|
||||
}
|
||||
}()
|
||||
err := cmd.Wait()
|
||||
close(waitDone)
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user