Working tty and io support in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
8e5e9ae70e
commit
b59bd59d8a
9 changed files with 171 additions and 79 deletions
10
shim/exec.go
10
shim/exec.go
|
@ -7,6 +7,7 @@ import (
|
|||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/crosbymichael/console"
|
||||
runc "github.com/crosbymichael/go-runc"
|
||||
apishim "github.com/docker/containerd/api/shim"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
@ -16,7 +17,7 @@ type execProcess struct {
|
|||
sync.WaitGroup
|
||||
|
||||
id string
|
||||
console *runc.Console
|
||||
console console.Console
|
||||
io runc.IO
|
||||
status int
|
||||
pid int
|
||||
|
@ -42,6 +43,7 @@ func newExecProcess(context context.Context, r *apishim.ExecRequest, parent *ini
|
|||
if socket, err = runc.NewConsoleSocket(filepath.Join(cwd, "pty.sock")); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer os.Remove(socket.Path())
|
||||
} else {
|
||||
// TODO: get uid/gid
|
||||
if io, err = runc.NewPipeIO(0, 0); err != nil {
|
||||
|
@ -108,10 +110,12 @@ func (e *execProcess) Status() int {
|
|||
func (e *execProcess) Exited(status int) {
|
||||
e.status = status
|
||||
e.Wait()
|
||||
e.io.Close()
|
||||
if e.io != nil {
|
||||
e.io.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func (e *execProcess) Resize(ws runc.WinSize) error {
|
||||
func (e *execProcess) Resize(ws console.WinSize) error {
|
||||
if e.console == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue