using blocking cp method.
This commit is contained in:
parent
5e9ff92ff3
commit
7740c8fed5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue