Getting ctr closer to compiling on Windows

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-02-29 10:48:39 -08:00
parent 8d2051232a
commit d4ca79c978
18 changed files with 115 additions and 83 deletions

View file

@ -17,8 +17,8 @@ import (
"github.com/codegangsta/cli"
"github.com/docker/containerd/api/grpc/types"
"github.com/docker/containerd/specs"
"github.com/docker/docker/pkg/term"
"github.com/opencontainers/specs"
netcontext "golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
@ -538,23 +538,3 @@ type stdio struct {
stdout string
stderr string
}
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
}

30
ctr/container_unix.go Normal file
View 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
}

6
ctr/container_windows.go Normal file
View file

@ -0,0 +1,6 @@
package main
// TODO Windows: This will have a very different implementation
func createStdio() (s stdio, err error) {
return stdio{}, nil
}