Skip to content

Commit

Permalink
Merge pull request #162 from desimone/patch-3
Browse files Browse the repository at this point in the history
Update communicator.go
  • Loading branch information
pearkes committed Aug 7, 2014
2 parents 08c1a19 + 0cb0c41 commit 1244bff
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions helper/ssh/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type Config struct {
NoPty bool
}

// Creates a new packer.Communicator implementation over SSH. This takes
// New creates a new packer.Communicator implementation over SSH. This takes
// an already existing TCP connection and SSH configuration.
func New(address string, config *Config) (result *SSHCommunicator, err error) {
// Establish an initial connection and connect
Expand Down Expand Up @@ -182,19 +182,19 @@ func (c *SSHCommunicator) Start(cmd *RemoteCmd) (err error) {

func (c *SSHCommunicator) Upload(path string, input io.Reader) error {
// The target directory and file for talking the SCP protocol
target_dir := filepath.Dir(path)
target_file := filepath.Base(path)
targetDir := filepath.Dir(path)
targetFile := filepath.Base(path)

// On windows, filepath.Dir uses backslash separators (ie. "\tmp").
// This does not work when the target host is unix. Switch to forward slash
// which works for unix and windows
target_dir = filepath.ToSlash(target_dir)
targetDir = filepath.ToSlash(targetDir)

scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error {
return scpUploadFile(target_file, input, w, stdoutR)
return scpUploadFile(targetFile, input, w, stdoutR)
}

return c.scpSession("scp -vt "+target_dir, scpFunc)
return c.scpSession("scp -vt "+targetDir, scpFunc)
}

func (c *SSHCommunicator) UploadDir(dst string, src string, excl []string) error {
Expand Down

0 comments on commit 1244bff

Please sign in to comment.