containerd/linux/shim/process.go
Michael Crosby eb58ecab7c Add null io option
This adds null IO option for efficient handling of IO.
It provides a container directly with `/dev/null` and does not require
any io.Copy within the shim whenever a user does not want the IO of the
container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-14 13:09:16 -04:00

50 lines
1.1 KiB
Go

// +build !windows
package shim
import (
"context"
"io"
"time"
"github.com/containerd/console"
)
type stdio struct {
stdin string
stdout string
stderr string
terminal bool
}
func (s stdio) isNull() bool {
return s.stdin == "" && s.stdout == "" && s.stderr == ""
}
type process interface {
// ID returns the id for the process
ID() string
// Pid returns the pid for the process
Pid() int
// Resize resizes the process console
Resize(ws console.WinSize) error
// SetExited sets the exit status for the process
SetExited(status int)
// ExitStatus returns the exit status
ExitStatus() int
// ExitedAt is the time the process exited
ExitedAt() time.Time
// Delete deletes the process and its resourcess
Delete(context.Context) error
// Stdin returns the process STDIN
Stdin() io.Closer
// Kill kills the process
Kill(context.Context, uint32, bool) error
// Stdio returns io information for the container
Stdio() stdio
// Start execution of the process
Start(context.Context) error
// Status returns the process status
Status(ctx context.Context) (string, error)
}