Add exec process log support

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2015-12-15 11:43:51 -08:00
parent db181c6132
commit ec31245f54
9 changed files with 181 additions and 124 deletions

View File

@@ -13,10 +13,16 @@ func (h *AddProcessEvent) Handle(e *Event) error {
if !ok {
return ErrContainerNotFound
}
p, io, err := h.s.runtime.StartProcess(ci.container, *e.Process)
p, io, err := h.s.runtime.StartProcess(ci.container, *e.Process, e.Console)
if err != nil {
return err
}
if e.Pid, err = p.Pid(); err != nil {
return err
}
h.s.processes[e.Pid] = &containerInfo{
container: ci.container,
}
l, err := h.s.copyIO(e.Stdin, e.Stdout, e.Stderr, io)
if err != nil {
// log the error but continue with the other commands
@@ -25,12 +31,6 @@ func (h *AddProcessEvent) Handle(e *Event) error {
"id": e.ID,
}).Error("log stdio")
}
if e.Pid, err = p.Pid(); err != nil {
return err
}
h.s.processes[e.Pid] = &containerInfo{
container: ci.container,
copier: l,
}
h.s.processes[e.Pid].copier = l
return nil
}