From 760daebf5d39a329b74f463c95727da41d60f2a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cat=E2=84=A2?= <me@hackerc.at>
Date: Tue, 12 Jan 2021 06:41:35 +0000
Subject: [PATCH] Fix slashes when running on Windows (#461)

---
 pkg/container/docker_run.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go
index 2f7eeb2..d070f7e 100644
--- a/pkg/container/docker_run.go
+++ b/pkg/container/docker_run.go
@@ -12,6 +12,7 @@ import (
 	"path/filepath"
 	"regexp"
 	"strings"
+	"runtime"
 
 	"github.com/go-git/go-billy/v5/helper/polyfill"
 	"github.com/go-git/go-billy/v5/osfs"
@@ -333,6 +334,15 @@ func (cr *containerReference) extractGithubEnv(env *map[string]string) common.Ex
 func (cr *containerReference) exec(cmd []string, env map[string]string) common.Executor {
 	return func(ctx context.Context) error {
 		logger := common.Logger(ctx)
+		// Fix slashes when running on Windows
+		if runtime.GOOS == "windows" {
+			var newCmd []string
+			for _, v := range cmd {
+				newCmd = append(newCmd, strings.ReplaceAll(v, `\`, `/`))
+			}
+			cmd = newCmd
+		}
+		
 		logger.Debugf("Exec command '%s'", cmd)
 		isTerminal := term.IsTerminal(int(os.Stdout.Fd()))
 		envList := make([]string, 0)