Skip to content

Commit

Permalink
use path.join instead of filepath.join for ssh copy
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-prindle committed Sep 13, 2017
1 parent e6da47f commit b0dceef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/minikube/bootstrapper/ssh_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package bootstrapper
import (
"fmt"
"io"
"path/filepath"
"path"
goruntime "runtime"
"strings"
"sync"

"github.com/golang/glog"
Expand Down Expand Up @@ -81,7 +83,7 @@ func (s *SSHRunner) CombinedOutput(cmd string) (string, error) {

// Copy copies a file to the remote over SSH.
func (s *SSHRunner) Copy(f assets.CopyableFile) error {
deleteCmd := fmt.Sprintf("sudo rm -f %s", filepath.Join(f.GetTargetDir(), f.GetTargetName()))
deleteCmd := fmt.Sprintf("sudo rm -f %s", path.Join(f.GetTargetDir(), f.GetTargetName()))
mkdirCmd := fmt.Sprintf("sudo mkdir -p %s", f.GetTargetDir())
for _, cmd := range []string{deleteCmd, mkdirCmd} {
if err := s.Run(cmd); err != nil {
Expand Down Expand Up @@ -111,7 +113,11 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
fmt.Fprint(w, "\x00")
}()

scpcmd := fmt.Sprintf("sudo scp -t %s", f.GetTargetDir())
targetDir := f.GetTargetDir()
if goruntime.GOOS == "windows" {
targetDir = strings.Replace(f.GetTargetDir(), "\\", "/", -1)
}
scpcmd := fmt.Sprintf("sudo scp -t %s", targetDir)
if err := sess.Run(scpcmd); err != nil {
return errors.Wrapf(err, "Error running scp command: %s", scpcmd)
}
Expand Down

0 comments on commit b0dceef

Please sign in to comment.