diff --git a/builder/amazon/chroot/communicator.go b/builder/amazon/chroot/communicator.go index 741de2d83..9d4e4ce09 100644 --- a/builder/amazon/chroot/communicator.go +++ b/builder/amazon/chroot/communicator.go @@ -1,6 +1,7 @@ package chroot import ( + "fmt" "github.com/mitchellh/packer/packer" "io" "log" @@ -21,7 +22,7 @@ type Communicator struct { func (c *Communicator) Start(cmd *packer.RemoteCmd) error { chrootCommand := fmt.Sprintf("%s %s %s", c.ChrootCommand, c.Chroot, cmd.Command) - localcmd := exec.Command("/bin/sh", "-c", chrootCommand) + localCmd := exec.Command("/bin/sh", "-c", chrootCommand) localCmd.Stdin = cmd.Stdin localCmd.Stdout = cmd.Stdout localCmd.Stderr = cmd.Stderr diff --git a/builder/amazon/chroot/copy_files.go b/builder/amazon/chroot/copy_files.go index 0c4ef2dbc..ef5cd70b5 100644 --- a/builder/amazon/chroot/copy_files.go +++ b/builder/amazon/chroot/copy_files.go @@ -1,18 +1,15 @@ package chroot import ( - "log" + "fmt" "os/exec" ) -func copySingle(dst string, src string, copyCommand string) error { +func copySingle(dest string, src string, copyCommand string) error { cpCommand := fmt.Sprintf("sudo cp -fn %s %s", src, dest) - localcmd := exec.Command("/bin/sh", "-c", cpCommand) - log.Println(localcmd.Args) - out, err := localcmd.CombinedOutput() - if err != nil { - log.Println(err) + localCmd := exec.Command("/bin/sh", "-c", cpCommand) + if err := localCmd.Run(); err != nil { + return err } - log.Printf("output: %s", out) return nil }