Add working shim exec driver for start
Still need to implement a working Wait() on the process using epoll because of the non-blocking exit fifo Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
c76f883ccd
commit
90e4f130c8
6 changed files with 223 additions and 76 deletions
|
@ -1,8 +1,12 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/docker/containerkit"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
@ -177,3 +181,48 @@ func (t *testConfig) Spec(m *containerkit.Mount) (*specs.Spec, error) {
|
|||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func Stdin() *os.File {
|
||||
abs, err := filepath.Abs("stdin")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := unix.Mkfifo(abs, 0755); err != nil && !os.IsExist(err) {
|
||||
panic(err)
|
||||
}
|
||||
f, err := os.OpenFile(abs, syscall.O_RDWR, 0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func Stdout() *os.File {
|
||||
abs, err := filepath.Abs("stdout")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := unix.Mkfifo(abs, 0755); err != nil && !os.IsExist(err) {
|
||||
panic(err)
|
||||
}
|
||||
f, err := os.OpenFile(abs, syscall.O_RDWR, 0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func Stderr() *os.File {
|
||||
abs, err := filepath.Abs("stderr")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := unix.Mkfifo(abs, 0755); err != nil && !os.IsExist(err) {
|
||||
panic(err)
|
||||
}
|
||||
f, err := os.OpenFile(abs, syscall.O_RDWR, 0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue