Skip to content

Instantly share code, notes, and snippets.

@boucher
Created May 18, 2015 16:57
Show Gist options
  • Save boucher/f4848c0489ae2ae3cf78 to your computer and use it in GitHub Desktop.
Save boucher/f4848c0489ae2ae3cf78 to your computer and use it in GitHub Desktop.
var stdout bytes.Buffer
stdinR, stdinW, err := os.Pipe()
pconfig := libcontainer.Process{
Args: []string{"cat"},
Env: standardEnvironment,
Stdin: stdinR,
Stdout: &stdout,
}
err = container.Start(&pconfig)
stdinR.Close()
defer stdinW.Close()
bytesWritten, err := stdinW.WriteString(fmt.Sprintln("Hello!"))
output := string(stdout.Bytes())
log.Warnf("HERE: %v - %v", output, bytesWritten)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment