github.com/georgethebeatle/containerd@v0.2.5/ctr/container_linux.go (about)

     1  package main
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"path/filepath"
     7  	"syscall"
     8  )
     9  
    10  func createStdio() (s stdio, err error) {
    11  	tmp, err := ioutil.TempDir("", "ctr-")
    12  	if err != nil {
    13  		return s, err
    14  	}
    15  	// create fifo's for the process
    16  	for name, fd := range map[string]*string{
    17  		"stdin":  &s.stdin,
    18  		"stdout": &s.stdout,
    19  		"stderr": &s.stderr,
    20  	} {
    21  		path := filepath.Join(tmp, name)
    22  		if err := syscall.Mkfifo(path, 0755); err != nil && !os.IsExist(err) {
    23  			return s, err
    24  		}
    25  		*fd = path
    26  	}
    27  	return s, nil
    28  }