2014-02-21 16:27:15 -05:00
|
|
|
package execdriver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
2015-07-27 20:43:22 -04:00
|
|
|
// Pipes is a wrapper around a container's output for
|
2014-02-21 16:27:15 -05:00
|
|
|
// stdin, stdout, stderr
|
|
|
|
type Pipes struct {
|
|
|
|
Stdin io.ReadCloser
|
|
|
|
Stdout, Stderr io.Writer
|
|
|
|
}
|
|
|
|
|
2015-07-27 20:43:22 -04:00
|
|
|
// NewPipes returns a wrapper around a container's output
|
2014-02-21 16:27:15 -05:00
|
|
|
func NewPipes(stdin io.ReadCloser, stdout, stderr io.Writer, useStdin bool) *Pipes {
|
|
|
|
p := &Pipes{
|
|
|
|
Stdout: stdout,
|
|
|
|
Stderr: stderr,
|
|
|
|
}
|
|
|
|
if useStdin {
|
|
|
|
p.Stdin = stdin
|
|
|
|
}
|
|
|
|
return p
|
|
|
|
}
|