mirror of
https://github.com/drone/drone-cli.git
synced 2024-05-26 08:46:03 +02:00
fix drone exec on windows with docker toolbox
This commit is contained in:
parent
a785895ab0
commit
ecedcd0608
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -327,6 +328,15 @@ func exec(c *cli.Context) error {
|
|||
workspacePath = c.String("workspace-path")
|
||||
}
|
||||
dir, _ := filepath.Abs(filepath.Dir(file))
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
base := filepath.VolumeName(dir)
|
||||
if len(base) == 2 {
|
||||
dir = dir[2:]
|
||||
base = strings.ToLower(base[:1])
|
||||
dir = "/" + base + filepath.ToSlash(dir)
|
||||
}
|
||||
}
|
||||
volumes = append(volumes, c.String("prefix")+"_default:"+workspaceBase)
|
||||
volumes = append(volumes, dir+":"+path.Join(workspaceBase, workspacePath))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue