Update go-runc to f36917a18b3d962aee066063cba0bcff44e338ca
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
47
vendor/github.com/crosbymichael/go-runc/io.go
generated
vendored
47
vendor/github.com/crosbymichael/go-runc/io.go
generated
vendored
@@ -15,6 +15,10 @@ type IO interface {
|
||||
Set(*exec.Cmd)
|
||||
}
|
||||
|
||||
type StartCloser interface {
|
||||
CloseAfterStart() error
|
||||
}
|
||||
|
||||
// NewPipeIO creates pipe pairs to be used with runc
|
||||
func NewPipeIO(uid, gid int) (i IO, err error) {
|
||||
var pipes []*pipe
|
||||
@@ -92,11 +96,11 @@ func (i *pipeIO) Stdin() io.WriteCloser {
|
||||
}
|
||||
|
||||
func (i *pipeIO) Stdout() io.ReadCloser {
|
||||
return i.in.r
|
||||
return i.out.r
|
||||
}
|
||||
|
||||
func (i *pipeIO) Stderr() io.ReadCloser {
|
||||
return i.in.r
|
||||
return i.err.r
|
||||
}
|
||||
|
||||
func (i *pipeIO) Close() error {
|
||||
@@ -113,9 +117,48 @@ func (i *pipeIO) Close() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (i *pipeIO) CloseAfterStart() error {
|
||||
for _, f := range []*os.File{
|
||||
i.out.w,
|
||||
i.err.w,
|
||||
} {
|
||||
f.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Set sets the io to the exec.Cmd
|
||||
func (i *pipeIO) Set(cmd *exec.Cmd) {
|
||||
cmd.Stdin = i.in.r
|
||||
cmd.Stdout = i.out.w
|
||||
cmd.Stderr = i.err.w
|
||||
}
|
||||
|
||||
func NewSTDIO() (IO, error) {
|
||||
return &stdio{}, nil
|
||||
}
|
||||
|
||||
type stdio struct {
|
||||
}
|
||||
|
||||
func (s *stdio) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *stdio) Set(cmd *exec.Cmd) {
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
}
|
||||
|
||||
func (s *stdio) Stdin() io.WriteCloser {
|
||||
return os.Stdin
|
||||
}
|
||||
|
||||
func (s *stdio) Stdout() io.ReadCloser {
|
||||
return os.Stdout
|
||||
}
|
||||
|
||||
func (s *stdio) Stderr() io.ReadCloser {
|
||||
return os.Stderr
|
||||
}
|
||||
|
Reference in New Issue
Block a user