diff --git a/add_process.go b/add_process.go index d458b0b..bc7d72e 100644 --- a/add_process.go +++ b/add_process.go @@ -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 } diff --git a/api/grpc/server/server.go b/api/grpc/server/server.go index 6e105cc..34e82c9 100644 --- a/api/grpc/server/server.go +++ b/api/grpc/server/server.go @@ -76,6 +76,10 @@ func (s *apiServer) AddProcess(ctx context.Context, r *types.AddProcessRequest) e := containerd.NewEvent(containerd.AddProcessEventType) e.ID = r.Id e.Process = process + e.Console = r.Console + e.Stdin = r.Stdin + e.Stdout = r.Stdout + e.Stderr = r.Stderr s.sv.SendEvent(e) if err := <-e.Err; err != nil { return nil, err @@ -220,7 +224,7 @@ func (s *apiServer) Events(r *types.EventsRequest, stream types.API_EventsServer defer s.sv.Unsubscribe(events) for evt := range events { switch evt.Type { - case containerd.ExitEventType: + case containerd.ExitEventType, containerd.ExecExitEventType: ev := &types.Event{ Type: "exit", Id: evt.ID, diff --git a/api/grpc/types/api.pb.go b/api/grpc/types/api.pb.go index 798e3dc..4c63bd0 100644 --- a/api/grpc/types/api.pb.go +++ b/api/grpc/types/api.pb.go @@ -111,6 +111,10 @@ type AddProcessRequest struct { Args []string `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"` Env []string `protobuf:"bytes,5,rep,name=env" json:"env,omitempty"` Cwd string `protobuf:"bytes,6,opt,name=cwd" json:"cwd,omitempty"` + Stdin string `protobuf:"bytes,7,opt,name=stdin" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,8,opt,name=stdout" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,9,opt,name=stderr" json:"stderr,omitempty"` + Console string `protobuf:"bytes,10,opt,name=console" json:"console,omitempty"` } func (m *AddProcessRequest) Reset() { *m = AddProcessRequest{} } @@ -1082,95 +1086,96 @@ var _API_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor0 = []byte{ - // 1433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x57, 0xd9, 0x6e, 0x1c, 0x45, - 0x17, 0xf6, 0xcc, 0xf4, 0x6c, 0x67, 0x16, 0xdb, 0xed, 0xd8, 0x19, 0xcf, 0xff, 0x87, 0x24, 0x4d, - 0x80, 0x08, 0x45, 0x56, 0x70, 0x58, 0x42, 0xb8, 0x80, 0xe0, 0x44, 0x09, 0x28, 0x01, 0x2b, 0xb1, - 0x91, 0xb8, 0x61, 0xd4, 0xee, 0x2e, 0x66, 0x8a, 0xe9, 0x8d, 0xee, 0x6a, 0x2f, 0xaf, 0x80, 0x78, - 0x1e, 0x1e, 0x00, 0x89, 0x7b, 0x9e, 0x83, 0xa7, 0xe0, 0xd4, 0xd2, 0xd5, 0xcb, 0x2c, 0x81, 0x0b, - 0x6e, 0x5a, 0xaa, 0xaa, 0x73, 0xbe, 0xf3, 0x9d, 0xb5, 0xab, 0xa0, 0x6b, 0x47, 0xf4, 0x20, 0x8a, - 0x43, 0x16, 0x9a, 0x4d, 0x76, 0x15, 0x91, 0xc4, 0xfa, 0xb5, 0x06, 0x7b, 0x47, 0x31, 0xb1, 0x19, - 0x39, 0x0a, 0x03, 0x66, 0xd3, 0x80, 0xc4, 0xaf, 0xc8, 0xcf, 0x29, 0x49,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b, 0x75, 0x29, 0xa3, 0x21, 0x1a, 0x7e, 0x46, 0xdd, 0x04, 0xcd, 0x35, 0xd0, - 0x83, 0xdb, 0x60, 0x16, 0xf9, 0x4a, 0x2f, 0x32, 0xa7, 0x05, 0x8e, 0xf5, 0x42, 0x47, 0x4e, 0xc7, - 0x74, 0x99, 0x63, 0xef, 0x94, 0x82, 0x5e, 0x17, 0xce, 0x6c, 0x2b, 0x67, 0x72, 0x4d, 0x6b, 0x0c, - 0xa3, 0x45, 0x34, 0x15, 0xbc, 0x07, 0x70, 0xfd, 0x09, 0xf1, 0xc8, 0x9b, 0x2c, 0x61, 0x54, 0x02, - 0xdb, 0x27, 0xb2, 0x58, 0x38, 0xe0, 0xa2, 0x92, 0x02, 0x7c, 0x1b, 0x76, 0x5f, 0xd0, 0x84, 0xad, - 0x85, 0xb3, 0xbe, 0x07, 0xc8, 0x05, 0x34, 0xb8, 0x36, 0x45, 0x2e, 0x29, 0x53, 0x99, 0xc2, 0xb0, - 0x30, 0x27, 0x12, 0x89, 0xea, 0x98, 0x3b, 0xd0, 0x4b, 0x03, 0x7a, 0xf9, 0x3a, 0x74, 0xe6, 0x84, - 0x25, 0xa2, 0x34, 0x3b, 0xa2, 0x72, 0x67, 0xc4, 0xf3, 0x44, 0x65, 0x76, 0xac, 0x2f, 0x60, 0xaf, - 0x6a, 0x5f, 0x45, 0xf8, 0x5d, 0xe8, 0xe5, 0xd1, 0x4a, 0xd0, 0x5a, 0x63, 0x79, 0xb8, 0x86, 0xd0, - 0x7f, 0xcd, 0x30, 0x5a, 0x8a, 0xb8, 0x75, 0x0b, 0x86, 0xba, 0x80, 0xc5, 0x81, 0xec, 0x06, 0x9b, - 0xa5, 0x89, 0x72, 0x67, 0x0e, 0x6d, 0x95, 0xce, 0x52, 0x1a, 0xff, 0x9b, 0xc2, 0xf3, 0xa0, 0xab, - 0xe9, 0xac, 0xce, 0x51, 0xa5, 0xc9, 0x65, 0x57, 0xdf, 0x86, 0x6e, 0x24, 0x79, 0x12, 0x69, 0xa7, - 0x77, 0x38, 0x54, 0x14, 0x32, 0xfe, 0xb9, 0x6b, 0xa2, 0xd1, 0xb1, 0x3e, 0xda, 0x2f, 0x6d, 0x67, - 0x86, 0xc6, 0xaa, 0xb6, 0x9c, 0x08, 0x85, 0x74, 0x8f, 0xfa, 0xc4, 0x0f, 0xe3, 0x2b, 0x61, 0xc7, - 0xb0, 0xbe, 0xc3, 0xee, 0x96, 0x11, 0x54, 0xa1, 0xbf, 0x83, 0x85, 0x9a, 0x71, 0xce, 0x22, 0xbf, - 0x95, 0x45, 0x5e, 0x3b, 0x73, 0x13, 0xda, 0xbe, 0xb4, 0xa5, 0x6a, 0x39, 0x23, 0xa7, 0x18, 0x58, - 0x4f, 0x60, 0xef, 0x34, 0x72, 0xdf, 0x34, 0xde, 0xf2, 0x89, 0x91, 0x4f, 0x10, 0xe9, 0x52, 0x23, - 0x1b, 0x4b, 0x0b, 0x28, 0xaa, 0x78, 0x37, 0x61, 0xf0, 0xf4, 0x9c, 0x60, 0x75, 0x64, 0xb9, 0xff, - 0xb3, 0x06, 0x4d, 0xb1, 0xc3, 0x3d, 0xe6, 0x64, 0x94, 0x0d, 0x69, 0xaf, 0x9e, 0xcf, 0x46, 0x8d, - 0x3f, 0xa8, 0x44, 0xde, 0x28, 0x8e, 0xb4, 0x66, 0x65, 0xa4, 0xb5, 0xc5, 0x1a, 0xfd, 0x56, 0x69, - 0x19, 0x75, 0x4a, 0x7e, 0x67, 0x49, 0x29, 0x87, 0xaf, 0xbb, 0x22, 0x7c, 0xe5, 0x69, 0x00, 0xab, - 0xa6, 0xc1, 0x6f, 0x35, 0xe8, 0x7f, 0x43, 0xd8, 0x45, 0x18, 0xcf, 0x79, 0x92, 0x92, 0x4a, 0xfb, - 0x61, 0xcd, 0xc6, 0x97, 0x93, 0xb3, 0x2b, 0x46, 0x64, 0x76, 0x0d, 0xee, 0x0f, 0xee, 0x1c, 0xdb, - 0xb2, 0xe9, 0x44, 0x86,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, 0x9e, 0x11, 0x26, 0xeb, 0xb9, 0x68, - 0x6a, 0x41, 0x45, 0x6c, 0x72, 0x95, 0xb3, 0x96, 0x78, 0xf5, 0x3f, 0xf8, 0x3b, 0x00, 0x00, 0xff, - 0xff, 0xa7, 0x4a, 0xd4, 0x7d, 0x02, 0x10, 0x00, 0x00, + // 1450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x58, 0xe9, 0x6e, 0x1c, 0x45, + 0x10, 0xf6, 0xee, 0xce, 0x5e, 0xb5, 0x87, 0xed, 0x71, 0xec, 0xac, 0x17, 0x42, 0x92, 0x21, 0x40, + 0x84, 0x22, 0x2b, 0x38, 0x1c, 0x21, 0xfc, 0x80, 0xe0, 0x44, 0x09, 0x28, 0x01, 0x2b, 0xb1, 0x91, + 0xf8, 0xc3, 0x6a, 0x3c, 0xd3, 0xac, 0x9b, 0x9d, 0x8b, 0x99, 0x1e, 0x1f, 0xaf, 0x80, 0x78, 0x1c, + 0xc4, 0x03, 0x20, 0xf1, 0x9f, 0xe7, 0xe0, 0x29, 0xa8, 0x3e, 0xa6, 0xe7, 0xd8, 0xc3, 0xf0, 0x83, + 0x3f, 0x2b, 0x75, 0x77, 0xd5, 0x57, 0x55, 0x5f, 0x1d, 0xd3, 0xbd, 0xd0, 0xb5, 0x23, 0xba, 0x17, + 0xc5, 0x21, 0x0b, 0xcd, 0x26, 0xbb, 0x8c, 0x48, 0x62, 0xfd, 0x5a, 0x83, 0x9d, 0x83, 0x98, 0xd8, + 0x8c, 0x1c, 0x84, 0x01, 0xb3, 0x69, 0x40, 0xe2, 0x57, 0xe4, 0xe7, 0x94, 0x24, 0xcc, 0x04, 0xa8, + 0x53, 0x77, 0x54, 0xbb, 0x55, 0xbb, 0xdb, 0x35, 0x71, 0x71, 0x92, 0x06, 0xae, 0x47, 0x0e, 0x6d, + 0x76, 0x3a, 0xaa, 0x8b, 0xbd, 0x01, 0x34, 0x13, 0xe6, 0xd2, 0x60, 0xd4, 0x10, 0xcb, 0x21, 0xb4, + 0x70, 0x19, 0xa6, 0x6c, 0x64, 0x14, 0xd6, 0x24, 0x8e, 0x47, 0x4d, 0xb1, 0x5e, 0x87, 0xb6, 0x13, + 0x06, 0x49, 0xe8, 0x91, 0x51, 0x2b, 0xc3, 0x74, 0x4e, 0x89, 0x33, 0x8b, 0x42, 0x1a, 0xb0, 0x51, + 0x9b, 0xef, 0x59, 0xbb, 0x70, 0x7d, 0xce, 0x9b, 0x24, 0x42, 0x35, 0x62, 0x3d, 0x84, 0xc1, 0x6b, + 0x3a, 0x0d, 0x6c, 0x6f, 0x91, 0x7f, 0x3d, 0x68, 0x44, 0xb8, 0xe0, 0x8e, 0x0d, 0x84, 0x65, 0x21, + 0x29, 0x3c, 0x1b, 0x58, 0x1b, 0x30, 0xcc, 0x34, 0x15, 0xd6, 0x6f, 0x35, 0xd8, 0x7c, 0xec, 0xba, + 0x87, 0x71, 0xe8, 0x90, 0x24, 0x59, 0x04, 0xb8, 0x01, 0x1d, 0x46, 0x62, 0x9f, 0x72, 0x14, 0x8e, + 0xda, 0x31, 0x77, 0xc1, 0x48, 0x13, 0x12, 0x0b, 0xcc, 0xde, 0x7e, 0x6f, 0x4f, 0xf0, 0xb7, 0x77, + 0x8c, 0x5b, 0x66, 0x1f, 0x0c, 0x3b, 0x9e, 0x26, 0x18, 0x78, 0x43, 0xfa, 0x42, 0x82, 0x33, 0x8c, + 0x5a, 0x2d, 0x9c, 0x73, 0x57, 0x45, 0xac, 0x19, 0x6b, 0x57, 0x18, 0xeb, 0x54, 0x18, 0xeb, 0x56, + 0x19, 0x03, 0xc1, 0xce, 0x43, 0x30, 0x84, 0x3d, 0x04, 0x4d, 0x95, 0xa7, 0x03, 0xbe, 0x98, 0xea, + 0xd0, 0x77, 0x60, 0x68, 0xbb, 0x2e, 0x65, 0x34, 0x44, 0xc7, 0x9f, 0x51, 0x37, 0x41, 0x77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, 0xd9, 0x87, + 0x42, 0x0c, 0xb7, 0xdc, 0x38, 0x8c, 0x22, 0x22, 0x23, 0x35, 0x38, 0xd8, 0x51, 0x06, 0xd6, 0xca, + 0xa4, 0x70, 0x27, 0x52, 0x60, 0xed, 0x0c, 0xec, 0x48, 0x83, 0x75, 0x0a, 0x62, 0x19, 0x58, 0x57, + 0x54, 0x95, 0x0f, 0x9d, 0x83, 0x28, 0x3d, 0x4e, 0xec, 0x29, 0xe1, 0x93, 0x80, 0x85, 0xcc, 0xf6, + 0x26, 0x29, 0x5f, 0x0a, 0xd7, 0x0d, 0xf3, 0x1a, 0xf4, 0x23, 0x12, 0x63, 0x5d, 0xaa, 0xdd, 0x3a, + 0x12, 0x65, 0x98, 0x6f, 0xc0, 0x96, 0x58, 0x4e, 0x68, 0x30, 0x99, 0x91, 0x38, 0x20, 0x9e, 0x1f, + 0xba, 0x44, 0xc5, 0xb1, 0x0b, 0x9b, 0xfa, 0x90, 0x37, 0xa6, 0x38, 0x12, 0xf1, 0x58, 0x47, 0x30, + 0x3c, 0x3a, 0xc5, 0xcf, 0x33, 0xf3, 0x68, 0x30, 0x7d, 0x62, 0x33, 0x9b, 0x7f, 0x03, 0x10, 0x9f, + 0x86, 0x6e, 0xa2, 0x0c, 0xa2, 0x36, 0x93, 0x22, 0xc4, 0x9d, 0x64, 0x47, 0x92, 0x34, 0x1c, 0xfe, + 0xf9, 0x11, 0xa3, 0xbe, 0x32, 0x68, 0xfd, 0x20, 0x82, 0x90, 0xc4, 0x5b, 0xd0, 0xcd, 0x9d, 0xad, + 0x89, 0x7c, 0xad, 0x67, 0xf9, 0xca, 0x02, 0xdd, 0x83, 0x75, 0xa6, 0xbd, 0x98, 0x60, 0xd5, 0xda, + 0xaa, 0x37, 0xb6, 0x95, 0x64, 0xd9, 0x47, 0xeb, 0x73, 0x80, 0x97, 0xa2, 0x15, 0x85, 0xc7, 0x38, + 0x1b, 0x8b, 0x04, 0x21, 0xd1, 0xbe, 0x7d, 0x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xf1, 0xb7, 0xc1, 0x83, 0x7f, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x8b, 0xba, 0x29, 0x23, 0x43, 0x10, 0x00, 0x00, } diff --git a/api/grpc/types/api.proto b/api/grpc/types/api.proto index 680b745..c2937a3 100644 --- a/api/grpc/types/api.proto +++ b/api/grpc/types/api.proto @@ -44,6 +44,10 @@ message AddProcessRequest { repeated string args = 4; // Arguments for process, first is binary path itself repeated string env = 5; // List of environment variables for process string cwd = 6; // Workind directory of process + string stdin = 7; // path to the file where stdin will be read (optional) + string stdout = 8; // path to file where stdout will be written (optional) + string stderr = 9; // path to file where stderr will be written (optional) + string console = 10; // path to the console for a container (optional) }; message User { diff --git a/ctr/container.go b/ctr/container.go index da8ea7d..e2c4768 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -112,11 +112,11 @@ var StartCommand = cli.Command{ fatal(err.Error(), 1) } if mkterm { - if err := attachTty(r); err != nil { + if err := attachTty(&r.Console); err != nil { fatal(err.Error(), 1) } } else { - if err := attachStdio(r); err != nil { + if err := attachStdio(&r.Stdin, &r.Stdout, &r.Stderr); err != nil { fatal(err.Error(), 1) } } @@ -149,6 +149,8 @@ var ( state *term.State ) +// readTermSetting reads the Terminal option out of the specs configuration +// to know if ctr should allocate a pty func readTermSetting(path string) (bool, error) { f, err := os.Open(filepath.Join(path, "config.json")) if err != nil { @@ -162,12 +164,12 @@ func readTermSetting(path string) (bool, error) { return spec.Process.Terminal, nil } -func attachTty(r *types.CreateContainerRequest) error { +func attachTty(consolePath *string) error { console, err := libcontainer.NewConsole(os.Getuid(), os.Getgid()) if err != nil { return err } - r.Console = console.Path() + *consolePath = console.Path() stdin = console go func() { io.Copy(os.Stdout, console) @@ -181,7 +183,7 @@ func attachTty(r *types.CreateContainerRequest) error { return nil } -func attachStdio(r *types.CreateContainerRequest) error { +func attachStdio(stdins, stdout, stderr *string) error { dir, err := ioutil.TempDir("", "ctr-") if err != nil { return err @@ -195,7 +197,7 @@ func attachStdio(r *types.CreateContainerRequest) error { path: filepath.Join(dir, "stdin"), flag: syscall.O_RDWR, done: func(f *os.File) { - r.Stdin = filepath.Join(dir, "stdin") + *stdins = filepath.Join(dir, "stdin") stdin = f }, }, @@ -203,7 +205,7 @@ func attachStdio(r *types.CreateContainerRequest) error { path: filepath.Join(dir, "stdout"), flag: syscall.O_RDWR, done: func(f *os.File) { - r.Stdout = filepath.Join(dir, "stdout") + *stdout = filepath.Join(dir, "stdout") go io.Copy(os.Stdout, f) }, }, @@ -211,7 +213,7 @@ func attachStdio(r *types.CreateContainerRequest) error { path: filepath.Join(dir, "stderr"), flag: syscall.O_RDWR, done: func(f *os.File) { - r.Stderr = filepath.Join(dir, "stderr") + *stderr = filepath.Join(dir, "stderr") go io.Copy(os.Stderr, f) }, }, @@ -266,6 +268,10 @@ var ExecCommand = cli.Command{ Name: "id", Usage: "container id to add the process to", }, + cli.BoolFlag{ + Name: "attach,a", + Usage: "connect to the stdio of the container", + }, cli.StringFlag{ Name: "cwd", Usage: "current working directory for the process", @@ -301,9 +307,42 @@ var ExecCommand = cli.Command{ }, } c := getClient(context) - if _, err := c.AddProcess(netcontext.Background(), p); err != nil { + events, err := c.Events(netcontext.Background(), &types.EventsRequest{}) + if err != nil { fatal(err.Error(), 1) } + if context.Bool("attach") { + if p.Terminal { + if err := attachTty(&p.Console); err != nil { + fatal(err.Error(), 1) + } + } else { + if err := attachStdio(&p.Stdin, &p.Stdout, &p.Stderr); err != nil { + fatal(err.Error(), 1) + } + } + } + r, err := c.AddProcess(netcontext.Background(), p) + if err != nil { + fatal(err.Error(), 1) + } + if context.Bool("attach") { + go func() { + io.Copy(stdin, os.Stdin) + if state != nil { + term.RestoreTerminal(os.Stdin.Fd(), state) + } + }() + for { + e, err := events.Recv() + if err != nil { + fatal(err.Error(), 1) + } + if e.Pid == r.Pid && e.Type == "exit" { + os.Exit(int(e.Status)) + } + } + } }, } diff --git a/exit.go b/exit.go index 27557cd..e4858a8 100644 --- a/exit.go +++ b/exit.go @@ -18,12 +18,11 @@ func (h *ExitEvent) Handle(e *Event) error { h.s.SendEvent(ne) return nil } - // is it the main container's process container, err := h.s.getContainerForPid(e.Pid) if err != nil { if err != errNoContainerForPid { - logrus.WithField("error", err).Error("containerd: find container for pid") + logrus.WithField("error", err).Error("containerd: find containers main pid") } return nil } diff --git a/linux/linux.go b/linux/linux.go index 1ea8b6d..da048ad 100644 --- a/linux/linux.go +++ b/linux/linux.go @@ -187,7 +187,7 @@ func (p *libcontainerProcess) Signal(s os.Signal) error { func (p *libcontainerProcess) Close() error { // in close we always need to call wait to close/flush any pipes - _, err := p.process.Wait() + p.process.Wait() // explicitly close any open fd on the process for _, cl := range []interface{}{ p.process.Stderr, @@ -200,7 +200,7 @@ func (p *libcontainerProcess) Close() error { } } } - return err + return nil } type libcontainerContainer struct { @@ -430,7 +430,7 @@ func (r *libcontainerRuntime) Create(id, bundlePath, consolePath string) (runtim return c, &rio, nil } -func (r *libcontainerRuntime) StartProcess(ci runtime.Container, p specs.Process) (runtime.Process, *runtime.IO, error) { +func (r *libcontainerRuntime) StartProcess(ci runtime.Container, p specs.Process, consolePath string) (runtime.Process, *runtime.IO, error) { c, ok := ci.(*libcontainerContainer) if !ok { return nil, nil, runtime.ErrInvalidContainerType @@ -439,9 +439,19 @@ func (r *libcontainerRuntime) StartProcess(ci runtime.Container, p specs.Process if err != nil { return nil, nil, err } - i, err := process.InitializeIO(int(p.User.UID)) - if err != nil { - return nil, nil, err + var rio runtime.IO + if p.Terminal { + if err := process.ConsoleFromPath(consolePath); err != nil { + return nil, nil, err + } + } else { + i, err := process.InitializeIO(int(p.User.UID)) + if err != nil { + return nil, nil, err + } + rio.Stdin = i.Stdin + rio.Stderr = i.Stderr + rio.Stdout = i.Stdout } if err := c.c.Start(process); err != nil { return nil, nil, err @@ -455,11 +465,7 @@ func (r *libcontainerRuntime) StartProcess(ci runtime.Container, p specs.Process return nil, nil, err } c.additionalProcesses[pid] = lp - return lp, &runtime.IO{ - Stdin: i.Stdin, - Stdout: i.Stdout, - Stderr: i.Stderr, - }, nil + return lp, &rio, nil } // newProcess returns a new libcontainer Process with the arguments from the diff --git a/runc/runc.go b/runc/runc.go index a2bd77b..fe357ae 100644 --- a/runc/runc.go +++ b/runc/runc.go @@ -196,7 +196,7 @@ func (r *runcRuntime) createIO(cmd *exec.Cmd) (*runtime.IO, error) { }, nil } -func (r *runcRuntime) StartProcess(ci runtime.Container, p specs.Process) (runtime.Process, *runtime.IO, error) { +func (r *runcRuntime) StartProcess(ci runtime.Container, p specs.Process, consolePath string) (runtime.Process, *runtime.IO, error) { c, ok := ci.(*runcContainer) if !ok { return nil, nil, runtime.ErrInvalidContainerType diff --git a/runtime/runtime.go b/runtime/runtime.go index 500067d..60abff6 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -22,5 +22,5 @@ type Runtime interface { // Create creates a new container initialized but without it starting it Create(id, bundlePath, consolePath string) (Container, *IO, error) // StartProcess adds a new process to the container - StartProcess(Container, specs.Process) (Process, *IO, error) + StartProcess(c Container, p specs.Process, consolePath string) (Process, *IO, error) }