Fix slashes when running on Windows (#461)
This commit is contained in:
parent
15eaa15a0e
commit
760daebf5d
1 changed files with 10 additions and 0 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/go-git/go-billy/v5/helper/polyfill"
|
"github.com/go-git/go-billy/v5/helper/polyfill"
|
||||||
"github.com/go-git/go-billy/v5/osfs"
|
"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 {
|
func (cr *containerReference) exec(cmd []string, env map[string]string) common.Executor {
|
||||||
return func(ctx context.Context) error {
|
return func(ctx context.Context) error {
|
||||||
logger := common.Logger(ctx)
|
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)
|
logger.Debugf("Exec command '%s'", cmd)
|
||||||
isTerminal := term.IsTerminal(int(os.Stdout.Fd()))
|
isTerminal := term.IsTerminal(int(os.Stdout.Fd()))
|
||||||
envList := make([]string, 0)
|
envList := make([]string, 0)
|
||||||
|
|
Loading…
Reference in a new issue