builder/docker: Remote execution works!

/cc @mwhooker - WOW. By luck, I had a hunch that maybe something like
this might be going on based on straces I was reading. Check:
https://github.com/dotcloud/docker/issues/2628

Anyways, this works now. No more blocker!
This commit is contained in:
Mitchell Hashimoto 2013-11-08 23:59:25 -08:00
parent 4cdd532a93
commit 41b17c3316
1 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import (
"os"
"os/exec"
"syscall"
"time"
)
type Communicator struct {
@ -34,6 +35,7 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
go func() {
defer stdin_w.Close()
time.Sleep(2 * time.Second)
stdin_w.Write([]byte(remote.Command + "\n"))
}()
@ -49,9 +51,8 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
}
}
if exitStatus != 0 {
return fmt.Errorf("Exit status: %d", exitStatus)
}
// Say that we ended!
remote.SetExited(exitStatus)
return nil
}