mirror of
https://github.com/moby/buildkit.git
synced 2025-10-25 16:57:55 +03:00
Sources are a pretty neat extension point, except there are a few code paths that hard-code against each type. This moves code around and adjusts interfaces so that Source implementations are self-contained and merely need to be registered with the source.Manager. Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
25 lines
357 B
Go
25 lines
357 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package git
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
)
|
|
|
|
func runWithStandardUmask(ctx context.Context, cmd *exec.Cmd) error {
|
|
if err := cmd.Start(); err != nil {
|
|
return err
|
|
}
|
|
waitDone := make(chan struct{})
|
|
go func() {
|
|
select {
|
|
case <-ctx.Done():
|
|
cmd.Process.Kill()
|
|
case <-waitDone:
|
|
}
|
|
}()
|
|
return cmd.Wait()
|
|
}
|