# HG changeset patch
# User Steeve Chailloux <steeve.chailloux@orus.io>
# Date 1690466962 -7200
#      Thu Jul 27 16:09:22 2023 +0200
# Node ID 17ff43b021783026c21232364c25b45c28d7985b
# Parent  631ced05d647e32398b1a98ba1b7838678c86a15
parallel build

diff --git a/runner/main.go b/runner/main.go
--- a/runner/main.go
+++ b/runner/main.go
@@ -8,6 +8,7 @@
 	"os"
 	"path/filepath"
 	"strings"
+	"sync"
 
 	"github.com/go-cmd/cmd"
 	"gopkg.in/yaml.v3"
@@ -319,14 +320,32 @@
 
 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)
 		}
-		compiled = append(compiled, f.Name())
+		return compiled, nil
 	}
-	return compiled, nil
 }
 
 func (r *Runner) runYtt(tmpDir string, compiled []string) (*os.File, error) {