Skip to content
Snippets Groups Projects

Few updates from downstream

Merged steeve.chailloux requested to merge topic/default/from-scl into branch/default
1 file
+ 25
6
Compare changes
  • Side-by-side
  • Inline
+ 25
6
@@ -8,6 +8,7 @@
"os"
"path/filepath"
"strings"
"sync"
"github.com/go-cmd/cmd"
"gopkg.in/yaml.v3"
@@ -319,8 +320,27 @@
func (r *Runner) runCommands(tmpDir string, cmds map[string]*cmd.Cmd) ([]string, error) {
var compiled []string
for name, cmd := range cmds {
f, err := r.runCommand(tmpDir, name, cmd)
if err != nil {
return nil, err
var wg sync.WaitGroup
errors := make(chan error, len(cmds))
results := make(chan string, len(cmds))
for name, command := range cmds {
wg.Add(1)
go func(name string, c *cmd.Cmd) {
defer wg.Done()
f, err := r.runCommand(tmpDir, name, c)
if err != nil {
errors <- err
}
results <- f.Name()
}(name, command)
}
wg.Wait()
select {
case err := <-errors:
// return only the first error if any
return nil, err
default:
close(results)
for res := range results {
compiled = append(compiled, res)
}
@@ -326,3 +346,3 @@
}
compiled = append(compiled, f.Name())
return compiled, nil
}
@@ -328,5 +348,4 @@
}
return compiled, nil
}
func (r *Runner) runYtt(tmpDir string, compiled []string) (*os.File, error) {
Loading