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