Getting ctr closer to compiling on Windows
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
30
ctr/container_unix.go
Normal file
30
ctr/container_unix.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// +build !windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func createStdio() (s stdio, err error) {
|
||||
tmp, err := ioutil.TempDir("", "ctr-")
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
// create fifo's for the process
|
||||
for name, fd := range map[string]*string{
|
||||
"stdin": &s.stdin,
|
||||
"stdout": &s.stdout,
|
||||
"stderr": &s.stderr,
|
||||
} {
|
||||
path := filepath.Join(tmp, name)
|
||||
if err := syscall.Mkfifo(path, 0755); err != nil && !os.IsExist(err) {
|
||||
return s, err
|
||||
}
|
||||
*fd = path
|
||||
}
|
||||
return s, nil
|
||||
}
|
Reference in New Issue
Block a user