Adding docker exec support in CLI.

Fixed a bug in daemon that resulted in accessing of a closed pipe.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
This commit is contained in:
Vishnu Kannan
2014-09-16 19:24:25 +00:00
parent 39030382c4
commit c786a8ee5e
9 changed files with 208 additions and 35 deletions
+1 -2
View File
@@ -206,7 +206,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
}()
}
if stderr != nil {
nJobs += 1
nJobs++
if p, err := streamConfig.StderrPipe(); err != nil {
errors <- err
} else {
@@ -229,7 +229,6 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
if err != nil {
log.Errorf("attach: stderr: %s", err)
}
log.Debugf("stdout attach end")
errors <- err
}()
}
+5 -5
View File
@@ -20,7 +20,7 @@ import (
type execConfig struct {
sync.Mutex
ID string
Running bool
Running bool
ProcessConfig execdriver.ProcessConfig
StreamConfig
OpenStdin bool
@@ -130,7 +130,7 @@ func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status {
StreamConfig: StreamConfig{},
ProcessConfig: processConfig,
Container: container,
Running: false,
Running: false,
}
d.registerExecCommand(execConfig)
@@ -141,8 +141,8 @@ func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status {
}
func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
if len(job.Args) != 2 {
return job.Errorf("Usage: %s [options] container exec", job.Name)
if len(job.Args) != 1 {
return job.Errorf("Usage: %s [options] exec", job.Name)
}
var (
@@ -165,11 +165,11 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status {
}
execConfig.Running = true
}()
if err != nil {
return job.Error(err)
}
log.Debugf("starting exec command %s in container %s", execConfig.ID, execConfig.Container.ID)
container := execConfig.Container
if execConfig.OpenStdin {