Commit e3ab74e0 authored by georgevicbell's avatar georgevicbell

Add Config struct for docker PTY

parent 39a8ba13
......@@ -24,10 +24,14 @@ type Communicator struct {
HostDir string
ContainerDir string
Version *version.Version
config *Config
lock sync.Mutex
}
type Config struct {
// Pty, if true, will request a pty from docker with -t
Pty bool
}
func (c *Communicator) Start(remote *packer.RemoteCmd) error {
// Create a temporary file to store the output. Because of a bug in
// Docker, sometimes all the output doesn't properly show up. This
......@@ -45,7 +49,11 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
var cmd *exec.Cmd
if c.canExec() {
if c.config.Pty {
cmd = exec.Command("docker", "exec", "-i", "-t", c.ContainerId, "/bin/sh")
} else {
cmd = exec.Command("docker", "exec", "-i", c.ContainerId, "/bin/sh")
}
} else {
cmd = exec.Command("docker", "attach", c.ContainerId)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment